summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2022-04-30 13:18:57 -0700
committerGitHub <noreply@github.com>2022-04-30 13:18:57 -0700
commit78f6f779627c89823d8402aac658418ef188be1c (patch)
treec6bfbb7f110660fdc211044179cd216cfdba716f /nixos/modules/system
parent405ce5693de092913107c8cfb33b328cee13addb (diff)
parentf3f2e55e594f6b1e6bd75d41125fea13d3889896 (diff)
downloadnixpkgs-78f6f779627c89823d8402aac658418ef188be1c.tar
nixpkgs-78f6f779627c89823d8402aac658418ef188be1c.tar.gz
nixpkgs-78f6f779627c89823d8402aac658418ef188be1c.tar.bz2
nixpkgs-78f6f779627c89823d8402aac658418ef188be1c.tar.lz
nixpkgs-78f6f779627c89823d8402aac658418ef188be1c.tar.xz
nixpkgs-78f6f779627c89823d8402aac658418ef188be1c.tar.zst
nixpkgs-78f6f779627c89823d8402aac658418ef188be1c.zip
Merge pull request #169113 from ElvishJerricco/systemd-stage-1-installer-tests
nixos: Installer tests for systemd stage 1
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/systemd/initrd.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix
index 2ec521a9844..fbccd0c4c89 100644
--- a/nixos/modules/system/boot/systemd/initrd.nix
+++ b/nixos/modules/system/boot/systemd/initrd.nix
@@ -479,6 +479,21 @@ in {
           ''systemctl --no-block switch-root /sysroot "''${NEW_INIT}"''
         ];
       };
+
+      services.panic-on-fail = {
+        wantedBy = ["emergency.target"];
+        unitConfig = {
+          DefaultDependencies = false;
+          ConditionKernelCommandLine = [
+            "|boot.panic_on_fail"
+            "|stage1panic"
+          ];
+        };
+        script = ''
+          echo c > /proc/sysrq-trigger
+        '';
+        serviceConfig.Type = "oneshot";
+      };
     };
 
     boot.kernelParams = lib.mkIf (config.boot.resumeDevice != "") [ "resume=${config.boot.resumeDevice}" ];