| 23 Jan 2025 |
matthewcroughan | and be like /device = "/store.squashfs"; | 02:54:00 |
matthewcroughan | * and be like device = "/store.squashfs"; | 02:54:15 |
ElvishJerricco | there's a very weird thing where initrd tries to nuke its own ramfs's contents before it does switch-root | 02:55:12 |
ElvishJerricco | so no | 02:55:14 |
ElvishJerricco | though I guess /run/store.squashfs is probably a tad more appropriate | 02:55:27 |
ElvishJerricco | and /run gets move-mounted in between stage 1 and stage 2 | 02:55:46 |
matthewcroughan | /run or /sysroot/run? | 02:55:53 |
ElvishJerricco | just /run to make things easy. That way you don't even need the RequiresMountsFor=/sysroot/yaddayadda | 02:56:15 |
ElvishJerricco | wait | 02:56:25 |
ElvishJerricco | nevermind | 02:56:26 |
ElvishJerricco | wait, nevermind again, that'll work :P | 02:56:33 |
matthewcroughan | This is a clustrerfuck | 02:57:06 |
matthewcroughan | * This is a clusterfuck | 02:57:08 |
ElvishJerricco | fileSystems."/nix/store" = {
device = "/run/store.squashfs";
fsType = "squashfs";
options = [ "loop" ];
};
boot.initrd.systemd.services.copytoram = {
before = [ "sysroot-nix-store.mount" ];
after = [ "dev-disk-by\\x2dpartlabel-nix\\x2dstore.device" ];
requires = [ "dev-disk-by\\x2dpartlabel-nix\\x2dstore.device" ];
serviceConfig.ExecStart = "${pkgs.coreutils}/bin/dd if=/dev/disk/by-partlabel/nix-store of=/run/store.squashfs";
serviceConfig.Type = "oneshot";
requiredBy = [ "initrd.target" ];
};
| 02:57:08 |
matthewcroughan | but in the end, it does produce some nice readable code | 02:57:14 |
matthewcroughan | I can't believe how much of a clusterfuck it can be though | 02:57:19 |
ElvishJerricco | yea, systemd initrd gets a little tricky | 02:57:20 |
ElvishJerricco | because it makes everything extremely explicit | 02:57:37 |
matthewcroughan | When I look at stuff like this, I think it's a miracle things work so well | 02:57:39 |
matthewcroughan | But it's even more fragile in the initrd shell scripts that came before hand | 02:57:59 |
matthewcroughan | These images are really quite nice to build as wel | 02:58:34 |
matthewcroughan | * These images are really quite nice to build as well | 02:58:36 |
matthewcroughan | I guess you can still nixos-rebuild switch this setup, since /boot is left in tact | 02:58:53 |
matthewcroughan | as long as you have enough ram 🤔 | 02:58:58 |
ElvishJerricco | well, you'll need a writable store for that | 02:59:16 |
ElvishJerricco | which means overlayfs shenanigans | 02:59:23 |
matthewcroughan | I was reading about systemd switch root stuff, and it has a soft switch mode | 03:00:39 |
ElvishJerricco | you mean soft-reboot? | 03:00:55 |
ElvishJerricco | that's complicated | 03:01:00 |
matthewcroughan | soft-reboot yeah | 03:01:05 |