From 949229f978544f74c9ee80e830788df00a3f0dd9 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Thu, 1 Oct 2026 15:13:24 +0200 Subject: [PATCH] kardorf: use disko to prepare for hardware change --- hosts/kardorf/default.nix | 7 ++-- hosts/kardorf/disko.nix | 73 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 hosts/kardorf/disko.nix diff --git a/hosts/kardorf/default.nix b/hosts/kardorf/default.nix index 6cc52d6..25ca51e 100644 --- a/hosts/kardorf/default.nix +++ b/hosts/kardorf/default.nix @@ -1,9 +1,13 @@ { pwd, pkgs, + inputs, ... }: { imports = [ + inputs.disko.nixosModules.disko + + ./disko.nix ./hardware-configuration.nix "${pwd}/features-nixos/global" @@ -33,9 +37,6 @@ networking.hostName = "kardorf"; system.stateVersion = "22.11"; - # Not using the drivers leads to way better results - # services.xserver.videoDrivers = [ "nvidia" ]; - programs.ausweisapp.enable = true; programs.ausweisapp.openFirewall = true; # for pairing with smartphone diff --git a/hosts/kardorf/disko.nix b/hosts/kardorf/disko.nix new file mode 100644 index 0000000..cbb624e --- /dev/null +++ b/hosts/kardorf/disko.nix @@ -0,0 +1,73 @@ +# https://github.com/nix-community/disko/blob/master/example/btrfs-subvolumes.nix +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-diskseq/1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "128M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = ["-f"]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + "/rootfs" = { + mountpoint = "/"; + }; + "/home" = { + mountOptions = ["compress=zstd"]; + mountpoint = "/home"; + }; + "/nix" = { + mountOptions = [ + "compress=zstd" + "noatime" + ]; + mountpoint = "/nix"; + }; + # Subvolume for the swapfile + "/swap" = { + mountpoint = "/.swapvol"; + swap = { + swapfile.size = "20M"; + swapfile2.size = "20M"; + swapfile2.path = "rel-path"; + }; + }; + }; + + mountpoint = "/partition-root"; + swap = { + swapfile = { + size = "20M"; + }; + swapfile1 = { + size = "20M"; + }; + }; + }; + }; + }; + }; + }; + }; + }; +}