summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd.nix
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2021-12-19 01:32:35 +0100
committerRaphael Megzari <raphael@megzari.com>2021-12-27 20:30:01 -0500
commitf2065d81ad9d25bbe581aef5c4c80845d7bb3041 (patch)
tree029b352507dee029ccc802af4ef1ad6e70a1ab77 /nixos/modules/system/boot/systemd.nix
parent4aaf4c256b94f8789e116473e7f86201002ecf2f (diff)
downloadnixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.tar
nixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.tar.gz
nixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.tar.bz2
nixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.tar.lz
nixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.tar.xz
nixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.tar.zst
nixpkgs-f2065d81ad9d25bbe581aef5c4c80845d7bb3041.zip
stdenv/generic: introduce shellDryRun
Add `shellDryRun` to the generic stdenv and substitute it for uses of
`${stdenv.shell} -n`. The point of this layer of abstraction is to add
the flag `-O extglob`, which resolves #126344 in a more direct way.
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r--nixos/modules/system/boot/systemd.nix16
1 files changed, 5 insertions, 11 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index ec5dea075bb..76c59c047e0 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -210,20 +210,14 @@ let
   makeJobScript = name: text:
     let
       scriptName = replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
-      out = pkgs.writeTextFile {
+      out = (pkgs.writeShellScriptBin scriptName ''
+        set -e
+        ${text}
+      '').overrideAttrs (_: {
         # The derivation name is different from the script file name
         # to keep the script file name short to avoid cluttering logs.
         name = "unit-script-${scriptName}";
-        executable = true;
-        destination = "/bin/${scriptName}";
-        text = ''
-          #!${pkgs.runtimeShell} -e
-          ${text}
-        '';
-        checkPhase = ''
-          ${pkgs.stdenv.shell} -n "$out/bin/${scriptName}"
-        '';
-      };
+      });
     in "${out}/bin/${scriptName}";
 
   unitConfig = { config, options, ... }: {