Add option "environment.binsh" to configure the shell executable used to create the global /bin/sh symlink.

This commit is contained in:
Peter Simons 2012-11-11 21:46:25 +01:00
parent 04ba5de70a
commit 622a652411

View File

@ -58,6 +58,18 @@ let
type = with pkgs.lib.types; bool;
};
environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh";
example = "\${pkgs.dash}/bin/dash";
type = with pkgs.lib.types; path;
description = ''
Select the shell executable that is linked system-wide to
<literal>/bin/sh</literal>. Please note that NixOS assumes all
over the place that shell to be Bash, so override the default
setting only if you know exactly what you're doing.
'';
};
};
in
@ -99,7 +111,7 @@ in
# Create the required /bin/sh symlink; otherwise lots of things
# (notably the system() function) won't work.
mkdir -m 0755 -p /bin
ln -sfn ${config.system.build.binsh}/bin/sh /bin/.sh.tmp
ln -sfn "${config.environment.binsh}" /bin/.sh.tmp
mv /bin/.sh.tmp /bin/sh # atomically replace /bin/sh
'';