diff options
author | Naïm Favier <n@monade.li> | 2021-12-19 01:32:35 +0100 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-12-27 20:30:01 -0500 |
commit | f2065d81ad9d25bbe581aef5c4c80845d7bb3041 (patch) | |
tree | 029b352507dee029ccc802af4ef1ad6e70a1ab77 /nixos/modules | |
parent | 4aaf4c256b94f8789e116473e7f86201002ecf2f (diff) | |
download | nixpkgs-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')
-rw-r--r-- | nixos/modules/system/activation/top-level.nix | 4 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 16 |
2 files changed, 7 insertions, 13 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 501998fa399..3c48d6bfd85 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -55,8 +55,8 @@ let substituteInPlace $out/dry-activate --subst-var out chmod u+x $out/activate $out/dry-activate unset activationScript dryActivationScript - ${pkgs.stdenv.shell} -n $out/activate - ${pkgs.stdenv.shell} -n $out/dry-activate + ${pkgs.stdenv.shellDryRun} $out/activate + ${pkgs.stdenv.shellDryRun} $out/dry-activate cp ${config.system.build.bootStage2} $out/init substituteInPlace $out/init --subst-var-by systemConfig $out 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, ... }: { |