summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-02-22 18:47:53 +0000
committerAlyssa Ross <hi@alyssa.is>2019-02-22 18:47:53 +0000
commit43c723b3c60350eb72b11e658b2e6a122fda6bfc (patch)
treeafc0f8933110431cfbe7f246720077d0f2a82221 /nixos/modules/system/activation/top-level.nix
parent6141939d6e0a77c84905efd560c03c3032164ef1 (diff)
downloadnixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.tar
nixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.tar.gz
nixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.tar.bz2
nixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.tar.lz
nixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.tar.xz
nixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.tar.zst
nixlib-43c723b3c60350eb72b11e658b2e6a122fda6bfc.zip
s6 experiments sixos
Diffstat (limited to 'nixos/modules/system/activation/top-level.nix')
-rw-r--r--nixos/modules/system/activation/top-level.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index a560af5ce96d..4bee55d80fbb 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -52,6 +52,20 @@ let
 
         echo -n "$kernelParams" > $out/kernel-params
 
+        ln -s ${
+          
+          pkgs.makeInitrd {
+            contents = [
+              { symlink = "init";
+                object = pkgs.writeScript "init" ''
+                  echo hello world
+                '';
+              }
+            ];
+          }
+
+        }/${config.system.boot.loader.initrdFile} $out/s6-initrd
+
         ln -s ${initrdPath} $out/initrd
 
         ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out
@@ -65,6 +79,30 @@ let
       unset activationScript
 
       cp ${config.system.build.bootStage2} $out/init
+
+      ${pkgs.s6-linux-init}/bin/s6-linux-init-maker \
+        -G "${pkgs.utillinux}/bin/agetty --noclear 38400 tty1" \
+        -c $out/s6 \
+        -b ${pkgs.execline.bin}/bin \
+        -p ${lib.makeBinPath (with pkgs; [ execline s6 s6-portable-utils s6-linux-utils s6-linux-init ])} \
+        -s /run/kernel-env \
+        -2 $out/s6/rc.init \
+        -Z ${pkgs.writeScript "shutdown" ''
+          #!${pkgs.execline}/bin/execlineb -P
+          echo alyssa shutting down
+        ''} \
+        $out/s6
+      sed -i '9aif { ${pkgs.coreutils}/bin/mkfifo -m 600 /run/service/s6-svscan-log/fifo }' "$out/s6/init"
+      rm $out/s6/run-image/service/s6-svscan-log/fifo
+
+      cat <<RC >$out/s6/rc.init
+      #!${pkgs.execline}/bin/execlineb -P
+      if { $out/activate }
+      if { ${config.s6.rc.initCommand} }
+      ${config.s6.rc.command}
+      RC
+      chmod +x $out/s6/rc.init
+
       substituteInPlace $out/init --subst-var-by systemConfig $out
 
       ln -s ${config.system.build.etc}/etc $out/etc