diff --git a/flake.nix b/flake.nix index c7d6c0a..d986a1f 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # declarative impermanence impermanence = { url = "github:nix-community/impermanence"; @@ -97,6 +102,7 @@ nixos-generators, nur, impermanence, + disko, ... }@inputs: let @@ -211,6 +217,7 @@ { nixpkgs.hostPlatform = system; } ./nixos inputs.impermanence.nixosModules.impermanence + inputs.disko.nixosModules.disko ]; in diff --git a/hosts/cyper-node-1/configuration.nix b/hosts/cyper-node-1/configuration.nix index 9826ea0..53c8f6b 100644 --- a/hosts/cyper-node-1/configuration.nix +++ b/hosts/cyper-node-1/configuration.nix @@ -1,5 +1,6 @@ { imports = [ + ./disko.nix ./hardware-configuration.nix ]; diff --git a/hosts/cyper-node-1/disko.nix b/hosts/cyper-node-1/disko.nix new file mode 100644 index 0000000..2de2c15 --- /dev/null +++ b/hosts/cyper-node-1/disko.nix @@ -0,0 +1,68 @@ +{ + disko.devices.disk.main = { + type = "disk"; + device = "/dev/sda"; # change to your actual disk, e.g. /dev/nvme0n1 + content = { + type = "gpt"; + partitions = { + + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "fmask=0022" + "dmask=0022" + ]; + extraArgs = [ + "-n" + "NIXBOOT" + ]; + }; + }; + + swap = { + size = "4G"; + content = { + type = "swap"; + extraArgs = [ + "-L" + "NIXSWAP" + ]; + }; + }; + + nix = { + size = "50G"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/nix"; + mountOptions = [ "defaults" ]; + extraArgs = [ + "-L" + "NIXSTORE" + ]; + }; + }; + + persist = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/persist"; + extraArgs = [ + "-L" + "NIXPERSIST" + ]; + }; + }; + + }; + }; + }; +} diff --git a/hosts/cyper-node-1/hardware-configuration.nix b/hosts/cyper-node-1/hardware-configuration.nix index df531ed..19a7eee 100644 --- a/hosts/cyper-node-1/hardware-configuration.nix +++ b/hosts/cyper-node-1/hardware-configuration.nix @@ -52,10 +52,7 @@ }; swapDevices = [ - { - device = "/persist/swapfile"; - size = 4096; - } + { device = "/dev/disk/by-label/NIXSWAP"; } ]; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;