{ config, pkgs, modulesPath, ... }: { imports = [ "${modulesPath}/image/repart.nix" ]; 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 = { name = "image"; 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"; # 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 # ''; }; # 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"; }; }; "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"; }; }; }; }; # 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 = "/"; # }; # }; # }; # }; # }; }