Move fake-passwd into combinators

This commit is contained in:
Alex David 2025-08-07 17:26:51 -07:00
commit d8500ab273
4 changed files with 46 additions and 14 deletions

View file

@ -11,17 +11,5 @@ pkgs: let helpers = import ./helpers.nix pkgs; in combinators: with combinators;
(fwd-env "LANG")
(fwd-env "HOME")
(fwd-env "TERM")
(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:$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
'')
(ro-bind (noescape (helpers.dataDirSubPath "passwd")) "/etc/passwd")
(ro-bind (noescape (helpers.dataDirSubPath "group")) "/etc/group")
fake-passwd
]