From 35dcf8940022c269aa39fe13ac07d4d5f6857507 Mon Sep 17 00:00:00 2001 From: tux Date: Sat, 9 May 2026 05:36:27 +0530 Subject: [PATCH] feat(sirius): enable impermanence --- modules/hosts/sirius/config.nix | 1 + modules/hosts/sirius/disko.nix | 82 +++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 modules/hosts/sirius/disko.nix diff --git a/modules/hosts/sirius/config.nix b/modules/hosts/sirius/config.nix index 7e0819c..ac28808 100644 --- a/modules/hosts/sirius/config.nix +++ b/modules/hosts/sirius/config.nix @@ -18,6 +18,7 @@ tnix = { boot.secure-boot.enable = true; + boot.impermanence.enable = true; networking.openssh.enable = true; virtualisation = { diff --git a/modules/hosts/sirius/disko.nix b/modules/hosts/sirius/disko.nix new file mode 100644 index 0000000..7704fb5 --- /dev/null +++ b/modules/hosts/sirius/disko.nix @@ -0,0 +1,82 @@ +{ inputs, ... }: +{ + flake.modules.nixos.sirius = + { config, lib, ... }: + let + hasOptinPersistence = config.tnix.boot.impermanence.enable; + in + { + imports = [ + inputs.disko.nixosModules.disko + ]; + + disko.devices.disk.primary = { + device = "/dev/nvme1n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + "umask=0077" + ]; + }; + }; + swap = { + size = "70G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; + }; + }; + root = { + size = "100%"; + type = "8300"; + content = { + type = "btrfs"; + # Base subvolumes that always exist + subvolumes = { + "/root" = { + mountOptions = [ + "compress=zstd" + "noatime" + "space_cache=v2" + ]; + mountpoint = "/"; + }; + "/nix" = { + mountOptions = [ + "compress=zstd" + "noatime" + "noacl" + "space_cache=v2" + ]; + mountpoint = "/nix"; + }; + } + # Conditionally merge /persist only when impermanence is enabled + // lib.optionalAttrs hasOptinPersistence { + "/persist" = { + mountOptions = [ + "compress=zstd" + "noatime" + "space_cache=v2" + ]; + mountpoint = "/persist"; + }; + }; + }; + }; + }; + }; + }; + }; +}