Skip to content

Commit 2306220

Browse files
committed
update
1 parent ed06c0e commit 2306220

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

kexec/default.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"/etc/ssh/ssh_config".text = ''
4040
Host github.com
4141
User git
42-
IdentityFile /run/credentials/github-private-key
42+
IdentityFile /run/credentials/@system/github-private-key
4343
'';
4444

4545
"/etc/nix/nix.conf".text = ''
@@ -120,18 +120,23 @@
120120
'';
121121
};
122122

123+
# Disable nixpkgs defined sysroot-run.mount (Not recursively mount /run)
124+
# https://github.com/NixOS/nixpkgs/blob/5df43628fdf08d642be8ba5b3625a6c70731c19c/nixos/modules/system/boot/systemd/initrd.nix#L640
125+
# https://matrix.to/#/!DBFhtjpqmJNENpLDOv:nixos.org/$DGOEtt-IPUHQSdKvpQQipiVE1NGthQBVn2oCGbTZ2hw
126+
boot.initrd.systemd.mounts = lib.mkForce [];
127+
123128
# move everything in / to /sysroot and switch-root into it.
124129
# This runs systemd initrd twice
125130
# but it is necessary for [nix --store flag / nixos-enter] as pivot_root does not work on rootfs.
126131
boot.initrd.systemd.services.remount-root = {
127132
unitConfig.ConditionKernelCommandLine = "systemd.mount-extra";
128-
after = [ "sysroot-run.mount" ]; # bind /run to /sysroot/run
133+
after = [ "initrd-fs.target" ];
129134
serviceConfig.Type = "oneshot";
130135
script = ''
131136
root_device_type="$(cat /proc/mounts | head -n 1 | cut -d ' ' -f 1)"
132-
if [ "$root_device_type" != "tmpfs" ]; then
137+
if [ "$root_device_type" != "tmpfs" ]
138+
then
133139
cp -R /init /bin /etc /lib /nix /root /sbin /var /sysroot
134-
cp /run/credentials/@system/github-private-key /sysroot/run/credentials/
135140
mkdir -p /sysroot/tmp
136141
systemctl --no-block switch-root
137142
fi

0 commit comments

Comments
 (0)