diff --git a/flake.lock b/flake.lock index afe9f93..b5ef50e 100644 --- a/flake.lock +++ b/flake.lock @@ -33,6 +33,27 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715070411, + "narHash": "sha256-5CNvkH0Nf7yMwgKhjUNg/lUK40C7DXB4zKOuA2jVO90=", + "owner": "nix-community", + "repo": "disko", + "rev": "4677f6c53482a8b01ee93957e3bdd569d51261d6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v1.6.1", + "repo": "disko", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -360,6 +381,7 @@ }, "root": { "inputs": { + "disko": "disko", "home-manager": "home-manager", "lanzaboote": "lanzaboote", "lix": "lix", diff --git a/hosts/Khanda/hardware-configuration.nix b/hosts/Khanda/hardware-configuration.nix index 3333807..3a0164b 100644 --- a/hosts/Khanda/hardware-configuration.nix +++ b/hosts/Khanda/hardware-configuration.nix @@ -43,11 +43,6 @@ "surface_kbd" "pinctrl_tigerlake" ]; - - luks.devices."luks-bd1fe396-6740-4e7d-af2c-26ca9a3031f1" = { - device = "/dev/disk/by-uuid/bd1fe396-6740-4e7d-af2c-26ca9a3031f1"; - crypttabExtraOpts = [ "tpm2-device=auto" ]; - }; }; kernelModules = [ @@ -68,22 +63,6 @@ extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/b34afd29-94ff-421b-bb96-8497951abf58"; - fsType = "btrfs"; - options = [ "subvol=@,compress=zstd" ]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/DD2A-9C83"; - fsType = "vfat"; - }; - }; - - # TODO: Disable once DIsko is up and running - swapDevices = [ { device = "/dev/disk/by-uuid/8c2519d9-3e47-4aa1-908d-98b1aa8b909d"; } ]; - networking = { useDHCP = lib.mkDefault true; hostName = "Khanda"; @@ -103,7 +82,7 @@ # boot.kernelPackages = lib.mkForce pkgs.linuxPackages_latest; # Disk management - disko.enableConfig = false; # Disable while testing + disko.enableConfig = true; # Disable while testing disko.devices = { disk = { nvme0n1 = { @@ -154,7 +133,7 @@ mountpoint = "/nix"; }; "/swap" = { - mountpoint = "/.swapvol"; + mountpoint = "/.swap"; swap.swapfile.size = "8G"; }; "/log" = { diff --git a/hosts/Shura/hardware-configuration.nix b/hosts/Shura/hardware-configuration.nix index 9bdfddd..d6f49de 100644 --- a/hosts/Shura/hardware-configuration.nix +++ b/hosts/Shura/hardware-configuration.nix @@ -66,13 +66,6 @@ }; }; - swapDevices = [ - { - device = "/swap/swapfile"; - size = 16384; - } - ]; - networking = { # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's @@ -86,4 +79,73 @@ }; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + # Disk management + disko.enableConfig = false; # Disable while testing + disko.devices = { + disk = { + nvme0n1 = { + type = "disk"; + device = ""; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + label = "boot"; + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + luks = { + size = "100%"; + label = "nixos"; + content = { + type = "luks"; + name = "cryptroot"; + settings = { + allowDiscards = true; + crypttabExtraOpts = ["tpm2-device=auto"]; + }; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "/root" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/"; + }; + "/home" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/home"; + }; + "/nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + "/swap" = { + mountpoint = "/.swap"; + swap.swapfile.size = "16G"; + }; + "/log" = { + mountpoint = "/var/log"; + mountOptions = ["compress=zstd" "noatime"]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; }