diff --git a/hosts/common/disks/rihla.nix b/hosts/common/disks/rihla.nix index 6ac525a..ec34f04 100644 --- a/hosts/common/disks/rihla.nix +++ b/hosts/common/disks/rihla.nix @@ -1,9 +1,20 @@ +{ + lib, + config, + device, + withSwap, + swapSize, + label, + ... +}: + { disko = { devices = { disk = { main = { - device = "/dev/nvme0n1"; + inherit device; + type = "disk"; content = { type = "gpt"; @@ -50,8 +61,8 @@ crypt_vg = { type = "lvm_vg"; lvs = { - swap = { - size = "64G"; + swap = lib.mkIf withSwap { + size = "${swapSize}G"; content = { type = "swap"; resumeDevice = true; @@ -63,20 +74,22 @@ type = "btrfs"; extraArgs = [ "-L" - "nixos" + label "-f" ]; subvolumes = { "@root" = { mountpoint = "/"; mountOptions = [ + "subvol=root" "compress=zstd" + "noatime" ]; }; - "@home" = { - mountpoint = "/home"; + "@persist" = { + mountpoint = config.hostSpec.persist; mountOptions = [ - "subvol=home" + "subvol=persist" "compress=zstd" "noatime" ]; diff --git a/hosts/nixos/rihla/default.nix b/hosts/nixos/rihla/default.nix index bd45153..efdcbb7 100644 --- a/hosts/nixos/rihla/default.nix +++ b/hosts/nixos/rihla/default.nix @@ -25,7 +25,12 @@ # ========= Disk Layout ========= # inputs.disko.nixosModules.disko - (lib.custom.relativeToRoot "hosts/common/disks/rihla.nix") + (lib.custom.relativeToRoot "hosts/common/disks/rihla.nix") { + device = "/dev/nvme0n1"; + withSwap = true; + swapSize = 64; + label = "nixos"; + } # # ========= Required Configs ========= @@ -67,6 +72,7 @@ # hostSpec = { hostName = "rihla"; + useYubikey = lib.mkForce true; }; networking = { diff --git a/modules/common/host-spec.nix b/modules/common/host-spec.nix index cad3547..64c6d18 100644 --- a/modules/common/host-spec.nix +++ b/modules/common/host-spec.nix @@ -40,6 +40,16 @@ description = "The home directory of the user"; default = "/home/${config.hostSpec.username}"; }; + impermenance = lib.mkOption { + type = lib.types.bool; + description = "Whether or not to enable impermenance"; + default = false; + }; + persist = lib.mkOption { + type = lib.types.str; + description = "The folder to persist data if impermenance is enabled"; + default = "/persist"; + }; useYubikey = lib.mkOption { type = lib.types.bool; default = false;