kardorf: use disko to prepare for hardware change

This commit is contained in:
2026-10-01 15:13:24 +02:00
parent 14a06588b6
commit 949229f978
2 changed files with 77 additions and 3 deletions
+4 -3
View File
@@ -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
+73
View File
@@ -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";
};
};
};
};
};
};
};
};
};
}