summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-1.nix
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2017-06-01 22:35:40 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2017-06-10 17:10:49 +0200
commit581226cfb456b4c116594f1b79f45945703a4a4c (patch)
tree368b03ee564aac2e0b3bf941e80d12d1cedb28d8 /nixos/modules/system/boot/stage-1.nix
parentf12b0a2179585d443bf0abab3ac1cfccebc24512 (diff)
downloadnixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.tar
nixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.tar.gz
nixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.tar.bz2
nixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.tar.lz
nixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.tar.xz
nixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.tar.zst
nixpkgs-581226cfb456b4c116594f1b79f45945703a4a4c.zip
nixos/bcache: /bin/sh -> ${bash}/bin/sh
Or else `services.udev.packages = [ bcache-tools ]` cannot be used.

To not break bcache in the initrd I'm modifying this in stage-1.nix:

  -  --replace /bin/sh ${extraUtils}/bin/sh
  +  --replace ${bash}/bin/sh ${extraUtils}/bin/sh

Reasoning behind that change:

* If not modifying the /bin/sh pattern in any way, it will also match
  ${bash}/bin/sh, creating a broken path like
  /nix/store/HASH-bash/nix/store/HASH-bash/bin/sh in the udev rule file.

* The addition of /bin/sh was done in 775f381a9e34
  ("stage-1: add bcache support"). It seems somewhat plausible that
  no new users have appeared since then and we can take this opportunity
  to back out of this change without much fear of regressions.

  If there _are_ regressions, they should be in the form of build time
  errors, not runtime (boot), due to how the udev rule output is checked
  for invalid path references. So low risk, IMHO.

* An alternative approach could be to copy the /bin/sh substitute rule
  over to the non-initrd udev rules implementation in NixOS, but I think
  this way is better:
  - The rules file comes with a working path out of the box.
  - We can use more precise pattern matching when modifying the udev
    rules for the initrd.
Diffstat (limited to 'nixos/modules/system/boot/stage-1.nix')
-rw-r--r--nixos/modules/system/boot/stage-1.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index e3a3b6f88cf..73608a0e27f 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -167,7 +167,7 @@ let
             --replace /sbin/blkid ${extraUtils}/bin/blkid \
             --replace ${pkgs.lvm2}/sbin ${extraUtils}/bin \
             --replace /sbin/mdadm ${extraUtils}/bin/mdadm \
-            --replace /bin/sh ${extraUtils}/bin/sh \
+            --replace ${pkgs.bash}/bin/sh ${extraUtils}/bin/sh \
             --replace /usr/bin/readlink ${extraUtils}/bin/readlink \
             --replace /usr/bin/basename ${extraUtils}/bin/basename \
             --replace ${udev}/bin/udevadm ${extraUtils}/bin/udevadm