diff options
Diffstat (limited to 'machines')
| -rw-r--r-- | machines/natest.nix | 120 |
1 files changed, 113 insertions, 7 deletions
diff --git a/machines/natest.nix b/machines/natest.nix index 1623bd3..fa8f1d5 100644 --- a/machines/natest.nix +++ b/machines/natest.nix @@ -1,13 +1,119 @@ -{ flake, modulesPath, perSystem, ... }: { +{ config, modulesPath, pkgs, lib, ... }: + +{ imports = [ - flake.outputs.nixosModules.disk - (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") - (modulesPath + "/profiles/qemu-guest.nix") + # flake.outputs.nixosModules.disk + # flake.outputs.nixosModules.desktop + (modulesPath + "/image/repart.nix") ]; + system.stateVersion = "25.05"; nixpkgs.hostPlatform = "x86_64-linux"; - system.stateVersion = "24.11"; - environment.systemPackages = [ perSystem.self.partitioner ]; - virtualisation.diskSize = 16384; + users.users.alice = { + group = "wheel"; + isNormalUser = true; + initialPassword = "hello"; + }; + + fileSystems = { + "/" = { + fsType = "tmpfs"; + options = [ "defaults" "mode=755" "size=2G" ]; + }; + "/boot" = { + device = "/dev/disk/by-partlabel/boot"; + fsType = "vfat"; + }; + "/nix/store" = { + device = "/dev/disk/by-partlabel/nix-store"; + fsType = "ext4"; + }; + "/var" = { + device = "/dev/disk/by-partlabel/var"; + fsType = "ext4"; + }; + "/home" = { + device = "/dev/disk/by-partlabel/home"; + fsType = "ext4"; + }; + }; + + image.repart = + let + inherit (pkgs.stdenv.hostPlatform) efiArch; + in + { + name = "image"; + partitions.esp = { + repartConfig = { + Format = "vfat"; + Label = "boot"; + SizeMinBytes = "256M"; + Type = "esp"; + }; + contents = { + "/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}"; + + "/EFI/nixos/${config.system.boot.loader.kernelFile}.efi".source = + "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}"; + + "/EFI/nixos/${config.system.boot.loader.initrdFile}.efi".source = + "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; + + "/loader/entries/nixos.conf".source = + pkgs.writeText "default-entry.conf" '' + title Coolio + linux /EFI/nixos/${config.system.boot.loader.kernelFile}.efi + initrd /EFI/nixos/${config.system.boot.loader.initrdFile}.efi + options init=${config.system.build.toplevel}/init root=fstab loglevel=4 + ''; + + "/loader/loader.conf".source = + pkgs.writeText "loader.conf" '' + timeout 5 + console-mode keep + ''; + }; + }; + partitions.nix-store = { + storePaths = [ config.system.build.toplevel ]; + nixStorePrefix = "/"; + repartConfig = { + Format = "ext4"; + Label = "nix-store"; + SizeMinBytes = "4G"; + Type = "linux-generic"; + }; + }; + }; + + boot.loader.systemd-boot = { + enable = true; + memtest86.enable = true; + }; + + boot.initrd.systemd = { + enable = true; + repart.enable = true; + }; + + systemd.repart.partitions = { + home = { + Format = "ext4"; + Label = "home"; + Type = "home"; + Weight = "2000"; + }; + var = { + Format = "ext4"; + Label = "var"; + Type = "var"; + Weight = "1000"; + }; + }; } |
