@@ -26,11 +26,6 @@ with lib;
26 # here and it causes a cyclic dependency.
26 # here and it causes a cyclic dependency.
27 boot.loader.grub.enable = false;
27 boot.loader.grub.enable = false;
29− boot.initrd.postMountCommands = ''
30− mkdir -p /mnt-root/nix/store
31− mount -t squashfs /nix-store.squashfs /mnt-root/nix/store
34 # !!! Hack - attributes expected by other modules.
29 # !!! Hack - attributes expected by other modules.
35 system.boot.loader.kernelFile = "bzImage";
30 system.boot.loader.kernelFile = "bzImage";
36 environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ];
31 environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ];
@@ -42,13 +37,34 @@ with lib;
42 options = [ "mode=0755" ];
37 options = [ "mode=0755" ];
40+ # In stage 1, mount a tmpfs on top of /nix/store (the squashfs
41+ # image) to make this a live CD.
42+ fileSystems."/nix/.ro-store" =
43+ { fsType = "squashfs";
44+ device = "../nix-store.squashfs";
45+ options = [ "loop" ];
46+ neededForBoot = true;
49+ fileSystems."/nix/.rw-store" =
51+ options = [ "mode=0755" ];
52+ neededForBoot = true;
55+ fileSystems."/nix/store" =
56+ { fsType = "unionfs-fuse";
58+ options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ];
45 boot.initrd.availableKernelModules = [ "squashfs" ];
61 boot.initrd.availableKernelModules = [ "squashfs" ];
47 boot.initrd.kernelModules = [ "loop" ];
63 boot.initrd.kernelModules = [ "loop" ];
49 # Closures to be copied to the Nix store, namely the init
65 # Closures to be copied to the Nix store, namely the init
50 # script and the top-level system configuration directory.
66 # script and the top-level system configuration directory.
51− netboot.storeContents =
67+ netboot.storeContents =
52 [ config.system.build.toplevel ];
68 [ config.system.build.toplevel ];
54 # Create the squashfs image that contains the Nix store.
70 # Create the squashfs image that contains the Nix store.