Remove which in builtin passwd combinator
This remove the requirement on `which` binary when running any jail. This was preventing jailed apps from running within nix sandbox without manually specifying `pkgs.which` as a build input.
This commit is contained in:
parent
8dc2189e08
commit
921b443cc9
1 changed files with 3 additions and 2 deletions
5
lib.nix
5
lib.nix
|
|
@ -55,9 +55,10 @@ in {
|
|||
|
||||
(add-runtime ''
|
||||
if [ ! -e ${helpers.dataDirSubPath "passwd"} ] || [ ! -e ${helpers.dataDirSubPath "group"} ]; then
|
||||
NOLOGIN=${pkgs.shadow}/bin/nologin
|
||||
mkdir -p ${helpers.dataDir}
|
||||
echo "root:x:0:0:System administrator:/root:$(which nologin)" > ${helpers.dataDirSubPath "passwd"}
|
||||
echo "$(id -un):x:$(id -u):$(id -g)::$HOME:$(which nologin)" >> ${helpers.dataDirSubPath "passwd"}
|
||||
echo "root:x:0:0:System administrator:/root:$NOLOGIN" > ${helpers.dataDirSubPath "passwd"}
|
||||
echo "$(id -un):x:$(id -u):$(id -g)::$HOME:$NOLOGIN" >> ${helpers.dataDirSubPath "passwd"}
|
||||
echo "root:x:0:" > ${helpers.dataDirSubPath "group"}
|
||||
echo "$(id -gn):x:$(id -g):" >> ${helpers.dataDirSubPath "group"}
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue