rewrite systemconfig in C and link statically

systemconfig (a.k.a "activate") is run from the initramfs. Converting
it from a shell script to an executable means it doesn't depend on
there being a shell in the initramfs
This commit is contained in:
Daniel Barlow
2023-04-15 17:15:44 +01:00
parent c744ef8c17
commit 1cc0b13b57
3 changed files with 77 additions and 26 deletions

View File

@@ -17,7 +17,7 @@ in
boot.initramfs.enable = true;
outputs = rec {
systemConfiguration =
pkgs.pkgsBuildBuild.systemconfig config.filesystem.contents;
pkgs.systemconfig config.filesystem.contents;
rootfs =
let
inherit (pkgs.pkgsBuildBuild) runCommand mtdutils;
@@ -27,7 +27,8 @@ in
depsBuildBuild = [ mtdutils ];
} ''
mkdir -p $TMPDIR/empty/nix/store/
cp ${systemConfiguration}/activate $TMPDIR/empty/activate
cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate
ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init
pkgClosure=${closureInfo {
rootPaths = [ systemConfiguration ];
}}