Kieran's opinionated (and probably slightly dumb) nix config

chore: Add disko configuration to moonlark

+82 -18
+21
flake.lock
··· 19 19 "type": "github" 20 20 } 21 21 }, 22 + "disko": { 23 + "inputs": { 24 + "nixpkgs": [ 25 + "nixpkgs" 26 + ] 27 + }, 28 + "locked": { 29 + "lastModified": 1721612107, 30 + "narHash": "sha256-1F2N90WqHV14oIn5RpDfzINj4zMi5gBQOt1BAc34gGM=", 31 + "owner": "nix-community", 32 + "repo": "disko", 33 + "rev": "2f5df5dcceb8473dd5715c4ae92f9b0d5f87fff9", 34 + "type": "github" 35 + }, 36 + "original": { 37 + "owner": "nix-community", 38 + "repo": "disko", 39 + "type": "github" 40 + } 41 + }, 22 42 "hardware": { 23 43 "locked": { 24 44 "lastModified": 1721413321, ··· 330 350 }, 331 351 "root": { 332 352 "inputs": { 353 + "disko": "disko", 333 354 "hardware": "hardware", 334 355 "home-manager": "home-manager", 335 356 "hyprland-nix": "hyprland-nix",
+9 -1
flake.nix
··· 14 14 15 15 # hyprland nix 16 16 hyprland-nix.url = "github:hyprland-community/hyprnix"; 17 + 18 + disko.url = "github:nix-community/disko"; 19 + disko.inputs.nixpkgs.follows = "nixpkgs"; 17 20 }; 18 21 19 22 outputs = { ··· 29 32 # Available through 'nixos-rebuild --flake .#your-hostname' 30 33 nixosConfigurations = { 31 34 moonlark = nixpkgs.lib.nixosSystem { 35 + system = "x86_64-linux"; 32 36 specialArgs = {inherit inputs outputs;}; 33 37 # > Our main nixos configuration file < 34 - modules = [./moonlark/configuration.nix]; 38 + modules = [ 39 + inputs.disko.nixosModules.disko 40 + { disko.devices.disk.disk1.device = "/dev/vda"; } 41 + ./moonlark/configuration.nix 42 + ]; 35 43 }; 36 44 }; 37 45 };
+18 -2
moonlark/configuration.nix
··· 17 17 18 18 # Import home-manager's configuration 19 19 ./home-manager.nix 20 + 21 + # Import disko's configuration 22 + ./disk-config.nix 20 23 ]; 21 24 22 25 nixpkgs = { ··· 46 49 nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; 47 50 }; 48 51 52 + environment.systemPackages = map lib.lowPrio [ 53 + pkgs.curl 54 + pkgs.gitMinimal 55 + ]; 56 + 49 57 networking = { 50 58 hostName = "moonlark"; 51 59 wireless.enable = true; ··· 63 71 ]; 64 72 extraGroups = ["wheel" "networkmanager" "audio" "docker"]; 65 73 }; 74 + root.openssh.authorizedKeys.keys = [ 75 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay" 76 + ] 66 77 }; 67 78 68 79 # enable cups ··· 96 107 }; 97 108 }; 98 109 99 - # Requires at least 5.16 for working wi-fi and bluetooth. 110 + # Requires at least 5.16 for working wi-fi and bluetooth. 100 111 # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 101 112 boot = { 102 113 kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); 103 - loader.grub.device = "/dev/disk/by-uuid/5A0A-6C6E"; 114 + loader.grub = { 115 + # no need to set devices, disko will add all devices that have a EF02 partition to the list already 116 + # devices = [ ]; 117 + efiSupport = true; 118 + efiInstallAsRemovable = true; 119 + }; 104 120 }; 105 121 106 122 # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
+34
moonlark/disk-config.nix
··· 1 + # Example to create a bios compatible gpt partition 2 + { lib, ... }: 3 + { 4 + disko.devices = { 5 + disk = { 6 + main = { 7 + device = "/dev/nvme0n1"; 8 + type = "disk"; 9 + content = { 10 + type = "gpt"; 11 + partitions = { 12 + ESP = { 13 + type = "EF00"; 14 + size = "500M"; 15 + content = { 16 + type = "filesystem"; 17 + format = "vfat"; 18 + mountpoint = "/boot"; 19 + }; 20 + }; 21 + root = { 22 + size = "100%"; 23 + content = { 24 + type = "filesystem"; 25 + format = "ext4"; 26 + mountpoint = "/"; 27 + }; 28 + }; 29 + }; 30 + }; 31 + }; 32 + }; 33 + }; 34 + }
-15
moonlark/hardware-configuration.nix
··· 13 13 boot.kernelModules = [ "kvm-intel" ]; 14 14 boot.extraModulePackages = [ ]; 15 15 16 - fileSystems."/" = 17 - { device = "/dev/disk/by-uuid/609fdd27-3c83-462b-aa3a-86924f13a1f1"; 18 - fsType = "ext4"; 19 - }; 20 - 21 - fileSystems."/boot" = 22 - { device = "/dev/disk/by-uuid/5A0A-6C6E"; 23 - fsType = "vfat"; 24 - options = [ "fmask=0077" "dmask=0077" ]; 25 - }; 26 - 27 - swapDevices = 28 - [ { device = "/dev/disk/by-uuid/96be258e-0dc9-4dde-97d3-d01ab48c9588"; } 29 - ]; 30 - 31 16 # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 32 17 # (the default) this is the recommended approach. When using systemd-networkd it's 33 18 # still possible to use this option, but it's recommended to use it in conjunction