Skip to content

Commit 8f32adf

Browse files
nzbrgithub-actions[bot]
authored andcommitted
merge /bin and /sbin (#666)
(cherry picked from commit 87aa106)
1 parent 171f91d commit 8f32adf

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

modules/systemd/native/default.nix

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,37 @@ with lib; {
2424
user.default = config.users.users.${cfg.defaultUser}.name;
2525
boot.systemd = true;
2626
};
27+
extraBin = [
28+
{ src = "${pkgs.shadow}/bin/login"; }
29+
];
2730
};
2831

2932
system.activationScripts = {
3033
createBootedSystemSymlink = stringAfter [ "specialfs" "users" "groups" ] ''
3134
echo "setting up /run/booted-system..."
3235
[[ -e /run/booted-system ]] || ln -sfn "$(readlink -f "$systemConfig")" /run/booted-system
3336
'';
34-
shimSystemd = stringAfter [ ] ''
37+
createSbin = stringAfter (optional cfg.populateBin "populateBin") (
38+
if cfg.populateBin
39+
then ''
40+
echo "setting up /sbin..."
41+
if [ ! -L /sbin ]; then
42+
rm -rf /sbin
43+
ln -s /bin /sbin
44+
fi
45+
''
46+
else ''
47+
echo "setting up /sbin..."
48+
if [ ! -d /sbin ]; then
49+
rm -rf /sbin
50+
mkdir -p /sbin
51+
fi
52+
''
53+
);
54+
shimSystemd = stringAfter [ "createSbin" ] ''
3555
echo "setting up /sbin/init shim..."
36-
mkdir -p /sbin
3756
ln -sf ${config.system.build.nativeUtils}/bin/systemd-shim /sbin/init
3857
'';
39-
setupLogin = lib.mkIf cfg.populateBin (stringAfter [ ] ''
40-
echo "setting up /bin/login..."
41-
mkdir -p /bin
42-
ln -sf ${pkgs.shadow}/bin/login /bin/login
43-
'');
4458
};
4559

4660
environment = {

0 commit comments

Comments
 (0)