{ config, pkgs, lib, modulesPath, ... }: { imports = [ "${modulesPath}/image/repart.nix" ]; fileSystems = { # "/" = { # fsType = "tmpfs"; # options = [ # "size=20%" # ]; # }; "/" = let partConf = config.image.repart.partitions."root".repartConfig; in { device = "/dev/disk/by-partuuid/${partConf.UUID}"; fsType = partConf.Format; }; # "/var" = # let # partConf = config.image.repart.partitions."var".repartConfig; # in # { # device = "/dev/disk/by-partuuid/${partConf.UUID}"; # fsType = partConf.Format; # }; "/boot" = let partConf = config.image.repart.partitions."esp".repartConfig; in { device = "/dev/disk/by-partuuid/${partConf.UUID}"; fsType = partConf.Format; }; # "/nix/store" = # let # partConf = config.image.repart.partitions."store".repartConfig; # in # { # device = "/dev/disk/by-partlabel/${partConf.Label}"; # fsType = partConf.Format; # }; }; boot.uki.name = "monkey"; # fileSystems."/".device = "/dev/disk/by-label/nixos"; # https://nixos.org/manual/nixos/stable/#sec-image-repart # https://x86.lol/generic/2024/08/28/systemd-sysupdate.html image.repart = let efiArch = pkgs.stdenv.hostPlatform.efiArch; in { name = config.boot.uki.name; # name = "image"; # split = true; partitions = { "esp" = { # The contents to end up in the filesystem image. contents = { # "/EFI/BOOT/BOOTX64.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-bootx64.efi"; "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; "/EFI/Linux/${config.system.boot.loader.ukiFile}".source = "${config.system.build.uki}/${config.system.boot.loader.ukiFile}"; # https://man.archlinux.org/man/loader.conf.5 "/loader/entries/loader.conf".source = pkgs.writeText "loader.conf" '' timeout 0 editor yes default * logLevel=debug ''; # "/loader/loader.conf".source = pkgs.writeText "loader.conf" '' # timeout 0 # editor yes # default * # logLevel=debug # ''; # nixos-*.conf # "/loader/entries/nixos.conf".source = pkgs.writeText "nixos.conf" '' # title NixOS # linux /EFI/nixos/kernel.efi # initrd /EFI/nixos/initrd.efi # options init=/nix/store/.../init root=LABEL=nixos # ''; # systemd-boot configuration "/loader/loader.conf".source = ( pkgs.writeText "$out" '' timeout 3 '' ); }; # https://www.man7.org/linux//man-pages/man5/repart.d.5.html repartConfig = { Priority = 1; Type = "esp"; MountPoint = "/boot"; Format = "vfat"; UUID = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"; SizeMinBytes = "500M"; SizeMaxBytes = "500M"; }; # repartConfig = { # Type = "esp"; # UUID = "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"; # Well known # Format = "vfat"; # SizeMinBytes = "256M"; # SplitName = "-"; # }; }; "root" = { storePaths = [ config.system.build.toplevel ]; repartConfig = { Priority = 2; Type = "root"; Label = "nixos"; MountPoint = "/"; Format = "ext4"; UUID = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"; # populates the fs twice Minimize = "guess"; # Minimize = "off"; # SizeMinBytes = "1G"; # SizeMaxBytes = "20G"; }; # "store" = { # storePaths = [ config.system.build.toplevel ]; # stripNixStorePrefix = true; # repartConfig = { # Type = "linux-generic"; # Label = "store_${config.system.image.version}"; # Format = "squashfs"; # Minimize = "off"; # ReadOnly = "yes"; # SizeMinBytes = "1G"; # SizeMaxBytes = "1G"; # SplitName = "store"; # }; # }; # # Placeholder for the second installed Nix store. # "store-empty" = { # repartConfig = { # Type = "linux-generic"; # Label = "_empty"; # Minimize = "off"; # SizeMinBytes = "1G"; # SizeMaxBytes = "1G"; # SplitName = "-"; # }; # }; # # Persistent storage # "var" = { # repartConfig = { # Type = "var"; # UUID = "4d21b016-b534-45c2-a9fb-5c16e091fd2d"; # Well known # Format = "xfs"; # Label = "nixos-persistent"; # Minimize = "off"; # # Has to be large enough to hold update files. # SizeMinBytes = "2G"; # SizeMaxBytes = "2G"; # SplitName = "-"; # # Wiping this gives us a clean state. # FactoryReset = "yes"; # }; # }; }; }; }; # disko.devices.disk.main = { # device = "/dev/sda"; # type = "disk"; # content = { # type = "gpt"; # partitions = { # MBR = { # priority = 0; # size = "1M"; # type = "EF02"; # }; # ESP = { # priority = 1; # size = "500M"; # type = "EF00"; # content = { # type = "filesystem"; # format = "vfat"; # mountpoint = "/boot"; # }; # }; # root = { # priority = 2; # size = "100%"; # content = { # type = "filesystem"; # format = "ext4"; # mountpoint = "/"; # }; # }; # }; # }; # }; }