forked from DGNum/liminix
Compare commits
3 commits
2a2d3baa55
...
14b59b5b62
Author | SHA1 | Date | |
---|---|---|---|
14b59b5b62 | |||
8c97f3e257 | |||
ae78f9aafd |
7 changed files with 181 additions and 105 deletions
|
@ -14,7 +14,7 @@ in
|
|||
"${modulesPath}/busybox.nix"
|
||||
"${modulesPath}/hostname.nix"
|
||||
"${modulesPath}/kernel"
|
||||
"${modulesPath}/s6"
|
||||
"${modulesPath}/systemd"
|
||||
"${modulesPath}/users.nix"
|
||||
"${modulesPath}/outputs.nix"
|
||||
"${modulesPath}/nixpkgs.nix"
|
||||
|
|
|
@ -129,10 +129,9 @@ in {
|
|||
# By default, we enable cross-compilation support.
|
||||
nixpkgs.buildPlatform = lib.mkDefault builtins.currentSystem;
|
||||
|
||||
defaultProfile.packages = with pkgs;
|
||||
[ s6 s6-init-bin execline s6-linux-init s6-rc ];
|
||||
# Set the useful PS1 prompt by default.
|
||||
defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt;
|
||||
defaultProfile.packages = with pkgs; [ execline ];
|
||||
|
||||
boot.commandLine = [
|
||||
"panic=10 oops=panic init=/bin/init loglevel=8"
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
### Things to do before hardware halt/reboot/poweroff.
|
||||
### Ideally, it should be a single call to the service manager,
|
||||
### telling it to bring all the services down.
|
||||
|
||||
### If your s6-linux-init-maker invocation was made with the -1
|
||||
### option, messages from rc.shutdown will appear on /dev/console
|
||||
### as well as be logged by the catch-all logger.
|
||||
### If your s6-linux-init-maker invocation did NOT include the -1
|
||||
### option, messages from rc.shutdown will only be logged by the
|
||||
### catch-all logger and will NOT appear on /dev/console. In order
|
||||
### to print them to /dev/console instead, you may want to
|
||||
### uncomment the following line:
|
||||
exec >/dev/console 2>&1
|
||||
|
||||
### If your services are managed by s6-rc:
|
||||
exec s6-rc -v2 -bDa change
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
## s6-linux-init-shutdownd never tells s6-svscan to exit, so if
|
||||
## you're running s6-linux-init, it's normal that your
|
||||
## .s6-svscan/finish script is not executed.
|
||||
|
||||
## The place where you want to hack things is /etc/rc.shutdown.final,
|
||||
## which is run by the stage 4 script right before the hard reboot.
|
||||
## So you can do dirty stuff [...] which should clean up the
|
||||
## s6-supervise and the foreground, and give control to
|
||||
## .s6-svscan/finish.
|
||||
|
||||
## -- Laurent Bercot on skaware mailing list,
|
||||
## https://skarnet.org/lists/skaware/1913.html
|
||||
|
||||
exec >/dev/console 2>&1
|
||||
|
||||
# down, exit supervisor, wait, stay down
|
||||
s6-svc -dxwD /run/service/s6-linux-init-shutdownd
|
||||
# HUP, exit supervisor, wait, down
|
||||
s6-svc -hxwd /run/service/s6-svscan-log
|
||||
s6-svscanctl -b /run/service # abort
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
### This script is called once at boot time by rc.init, and is
|
||||
### also called by the runleveld service every time the user
|
||||
### requests a machine state change via telinit.
|
||||
### Ideally, it should just be a call to the service manager.
|
||||
|
||||
test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; }
|
||||
|
||||
|
||||
### If your services are managed by s6-rc:
|
||||
exec s6-rc -v2 -up change "$1"
|
68
modules/systemd/default.nix
Normal file
68
modules/systemd/default.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.pseudofile) dir symlink;
|
||||
"getty.service" = {
|
||||
file =
|
||||
let
|
||||
login = pkgs.writeScript "login" ''
|
||||
#!/bin/ash
|
||||
exec /bin/ash
|
||||
'';
|
||||
in
|
||||
''
|
||||
[Unit]
|
||||
Description="Serial shell"
|
||||
|
||||
[Service]
|
||||
ExecStart=${pkgs.util-linux}/bin/agetty --login-program ${login} ttyS0
|
||||
'';
|
||||
mode = "0644";
|
||||
};
|
||||
"default.target" = {
|
||||
file = ''
|
||||
[Unit]
|
||||
Description="target to boot"
|
||||
Wants=getty.service
|
||||
After=getty.service
|
||||
AllowIsolate=yes
|
||||
'';
|
||||
};
|
||||
"sysinit.target" = {
|
||||
file = ''
|
||||
[Unit]
|
||||
Description="sysinit.target"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
kernel.config = {
|
||||
CGROUPS = "y";
|
||||
DEVTMPFS = "y";
|
||||
INOTIFY_USER = "y";
|
||||
SIGNALFD = "y";
|
||||
TIMERFD = "y";
|
||||
EPOLL = "y";
|
||||
UNIX = "y";
|
||||
SYSFS = "y";
|
||||
PROC_FS = "y";
|
||||
FHANDLE = "y";
|
||||
};
|
||||
boot.commandLine = [
|
||||
"systemd.log_level=7"
|
||||
#"systemd.crash_shell=true"
|
||||
];
|
||||
filesystem = dir {
|
||||
etc = dir {
|
||||
systemd = dir {
|
||||
system = dir {
|
||||
inherit "default.target" "getty.service" "sysinit.target";
|
||||
};
|
||||
};
|
||||
};
|
||||
bin = dir {
|
||||
init = symlink "${pkgs.systemd}/bin/init";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
160
overlay.nix
160
overlay.nix
|
@ -259,7 +259,12 @@ extraPkgs // {
|
|||
patches = o.patches ++ [
|
||||
./pkgs/qemu/arm-image-friendly-load-addr.patch
|
||||
];
|
||||
}); in q.override { nixosTestRunner = true; sdlSupport = false; hostCpuTargets = [ "mips-softmmu" ]; };
|
||||
}); in q.override {
|
||||
vde2 = null;
|
||||
nixosTestRunner = true;
|
||||
sdlSupport = false;
|
||||
hostCpuTargets = [ "mips-softmmu" ];
|
||||
};
|
||||
|
||||
rsyncSmall =
|
||||
let r = prev.rsync.overrideAttrs(o: {
|
||||
|
@ -330,54 +335,111 @@ extraPkgs // {
|
|||
};
|
||||
}) { };
|
||||
|
||||
systemd = prev.systemd.override {
|
||||
withAcl = false;
|
||||
withAnalyze = false;
|
||||
withApparmor = false;
|
||||
withAudit = false;
|
||||
withBootloader = false;
|
||||
# withCompression = true;
|
||||
withCoredump = false;
|
||||
withCryptsetup = false;
|
||||
withRepart = false;
|
||||
withDocumentation = false;
|
||||
withEfi = false;
|
||||
withFido2 = false;
|
||||
withHomed = false;
|
||||
# withHostnamed = true;
|
||||
withHwdb = false;
|
||||
withImportd = false;
|
||||
withIptables = false;
|
||||
withKmod = false;
|
||||
withLibBPF = false;
|
||||
withLibidn2 = false;
|
||||
withLocaled = false;
|
||||
# withLogind = true;
|
||||
withMachined = false;
|
||||
# withNetworkd = true;
|
||||
withNss = false;
|
||||
withOomd = false;
|
||||
# withPam = true;
|
||||
# withPasswordQuality = true;
|
||||
withPCRE2 = false;
|
||||
withPolkit = false;
|
||||
withPortabled = false;
|
||||
withQrencode = false;
|
||||
withRemote = false;
|
||||
# withResolved = true;
|
||||
# withShellCompletions = true;
|
||||
# withSysusers = true;
|
||||
withSysupdate = false;
|
||||
# withTimedated = true;
|
||||
# withTimesyncd = true;
|
||||
withTpm2Tss = false;
|
||||
withUkify = false;
|
||||
withUserDb = false;
|
||||
withUtmp = false;
|
||||
withVmspawn = false;
|
||||
withKernelInstall = false;
|
||||
withLibarchive = false;
|
||||
};
|
||||
systemd =
|
||||
let base = prev.systemd.override {
|
||||
withAcl = false;
|
||||
withAnalyze = false;
|
||||
withApparmor = false;
|
||||
withAudit = false;
|
||||
withBootloader = false;
|
||||
withCompression = false;
|
||||
withCoredump = false;
|
||||
withCryptsetup = false;
|
||||
withRepart = false;
|
||||
withDocumentation = false;
|
||||
withEfi = false;
|
||||
withFido2 = false;
|
||||
withHomed = false;
|
||||
withHostnamed = false;
|
||||
withHwdb = false;
|
||||
withImportd = false;
|
||||
withIptables = false;
|
||||
withKmod = false;
|
||||
withLibBPF = false;
|
||||
withLibidn2 = false;
|
||||
withLocaled = false;
|
||||
withLogind = false;
|
||||
withMachined = false;
|
||||
withNetworkd = false;
|
||||
withNss = false;
|
||||
withOomd = false;
|
||||
withPam = false;
|
||||
withPasswordQuality = false;
|
||||
withPCRE2 = false;
|
||||
withPolkit = false;
|
||||
withPortabled = false;
|
||||
withQrencode = false;
|
||||
withRemote = false;
|
||||
withResolved = false;
|
||||
withShellCompletions = false;
|
||||
withSysusers = false;
|
||||
withSysupdate = false;
|
||||
withTimedated = false;
|
||||
withTimesyncd = false;
|
||||
withTpm2Tss = false;
|
||||
withUkify = false;
|
||||
withUserDb = false;
|
||||
withUtmp = false;
|
||||
withVmspawn = false;
|
||||
withKernelInstall = false;
|
||||
withLibarchive = false;
|
||||
};
|
||||
in base.overrideAttrs (o: {
|
||||
mesonFlags = o.mesonFlags ++ [
|
||||
# "--optimization=s"
|
||||
"--default-library=static"
|
||||
"--buildtype=minsize"
|
||||
];
|
||||
postInstall = o.postInstall + ''
|
||||
rm -rf $out/share
|
||||
rm $out/lib/libudev.so*
|
||||
rm -rf $out/lib/systemd/catalog
|
||||
rm -rf $out/lib/systemd/system-generators
|
||||
rm $out/lib/systemd/systemd-backlight
|
||||
rm $out/lib/systemd/systemd-battery-check
|
||||
rm $out/lib/systemd/systemd-hibernate-resume
|
||||
rm $out/lib/systemd/systemd-makefs
|
||||
rm $out/lib/systemd/systemd-nsresourced
|
||||
rm $out/lib/systemd/systemd-nsresourcework
|
||||
rm $out/lib/systemd/systemd-shutdown
|
||||
rm $out/lib/systemd/systemd-sleep
|
||||
rm $out/lib/systemd/systemd-binfmt
|
||||
rm $out/lib/systemd/systemd-growfs
|
||||
rm $out/lib/systemd/systemd-mountfsd
|
||||
rm $out/lib/systemd/systemd-mountwork
|
||||
rm $out/lib/systemd/systemd-network-generator
|
||||
rm $out/lib/systemd/systemd-pstore
|
||||
rm $out/lib/systemd/systemd-remount-fs
|
||||
rm $out/lib/systemd/systemd-reply-password
|
||||
rm $out/lib/systemd/systemd-rfkill
|
||||
rm $out/lib/systemd/systemd-socket-proxyd
|
||||
rm $out/lib/systemd/systemd-ssh-proxy
|
||||
rm $out/lib/systemd/systemd-storagetm
|
||||
rm $out/lib/systemd/systemd-volatile-root
|
||||
rm $out/lib/systemd/systemd-xdg-autostart-condition
|
||||
rm -rf $out/example
|
||||
rm $out/bin/bootctl
|
||||
rm $out/bin/systemd-nspawn
|
||||
rm $out/bin/systemd-ac-power
|
||||
rm $out/bin/systemd-dissect
|
||||
rm $out/bin/systemd-ask-password
|
||||
rm $out/bin/systemd-cgls
|
||||
rm $out/bin/systemd-cgtop
|
||||
rm $out/bin/systemd-creds
|
||||
rm $out/bin/systemd-delta
|
||||
rm $out/bin/systemd-detect-virt
|
||||
rm $out/bin/systemd-escape
|
||||
rm $out/bin/systemd-id128
|
||||
rm $out/bin/systemd-machine-id-setup
|
||||
rm $out/bin/systemd-path
|
||||
rm $out/bin/systemd-run
|
||||
rm $out/bin/systemd-socket-activate
|
||||
rm $out/bin/systemd-stdio-bridge
|
||||
rm $out/bin/systemd-sysext
|
||||
rm $out/bin/systemd-tty-ask-password-agent
|
||||
rm $out/bin/systemd-vpick
|
||||
'';
|
||||
});
|
||||
|
||||
ubootQemuAarch64 = final.buildUBoot {
|
||||
defconfig = "qemu_arm64_defconfig";
|
||||
|
|
Loading…
Reference in a new issue