Improve disko declarations

main
Hektor Misplon 2025-11-17 21:20:00 +00:00
parent 5f65c9ad92
commit e8c9ea3af0
3 changed files with 105 additions and 66 deletions

View File

@ -1,4 +1,5 @@
{ {
lib,
inputs, inputs,
config, config,
pkgs, pkgs,
@ -13,7 +14,11 @@
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
./hard.nix ./hard.nix
../../modules/bootloader.nix ../../modules/bootloader.nix
../../modules/disko.zfs-encrypted-root.nix (import ../../modules/disko.zfs-encrypted-root.nix {
device = "/dev/nvme1n1";
inherit lib;
inherit config;
})
../../modules/gnome.nix ../../modules/gnome.nix
../../modules/bluetooth.nix ../../modules/bluetooth.nix
../../modules/keyboard ../../modules/keyboard
@ -26,6 +31,26 @@
../../modules/ssh/hardened-openssh.nix ../../modules/ssh/hardened-openssh.nix
]; ];
disko.devices = {
disk.data = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
data = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/data";
};
};
};
};
};
};
hardware = { hardware = {
graphics.enable = true; graphics.enable = true;
nvidia = { nvidia = {

View File

@ -1,4 +1,5 @@
{ {
lib,
inputs, inputs,
config, config,
pkgs, pkgs,
@ -13,7 +14,11 @@
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
./hard.nix ./hard.nix
../../modules/bootloader.nix ../../modules/bootloader.nix
../../modules/disko.zfs-encrypted-root.nix (import ../../modules/disko.zfs-encrypted-root.nix {
inherit lib;
inherit config;
device = "/dev/nvme0n1";
})
../../modules/gnome.nix ../../modules/gnome.nix
../../modules/bluetooth.nix ../../modules/bluetooth.nix
../../modules/keyboard ../../modules/keyboard

View File

@ -1,78 +1,87 @@
{ lib, config, ... }:
{ {
disko.devices = { options.device = lib.mkOption {
disk = { type = lib.types.str;
root = { example = "/dev/nvme0n1";
type = "disk"; };
device = "/dev/vda";
content = { config = {
type = "gpt"; disko.devices = {
partitions = { disk = {
ESP = { root = {
size = "1G"; type = "disk";
type = "EF00"; device = config.device;
content = { content = {
type = "filesystem"; type = "gpt";
format = "vfat"; partitions = {
mountpoint = "/boot"; ESP = {
mountOptions = [ "nofail" ]; size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "nofail" ];
};
}; };
}; zfs = {
zfs = { size = "100%";
size = "100%"; content = {
content = { type = "zfs";
type = "zfs"; pool = "zroot";
pool = "zroot"; };
}; };
}; };
}; };
}; };
}; };
}; zpool = {
zpool = { zroot = {
zroot = { type = "zpool";
type = "zpool"; rootFsOptions = {
rootFsOptions = { mountpoint = "none";
mountpoint = "none"; compression = "zstd";
compression = "zstd"; acltype = "posixacl";
acltype = "posixacl"; xattr = "sa";
xattr = "sa"; "com.sun:auto-snapshot" = "true";
"com.sun:auto-snapshot" = "true";
};
options.ashift = "12";
datasets = {
"root" = {
type = "zfs_fs";
options = {
encryption = "aes-256-gcm";
keyformat = "passphrase";
#keylocation = "file:///tmp/secret.key";
keylocation = "prompt";
};
mountpoint = "/";
};
"root/nix" = {
type = "zfs_fs";
options.mountpoint = "/nix";
mountpoint = "/nix";
}; };
options.ashift = "12";
datasets = {
"root" = {
type = "zfs_fs";
options = {
encryption = "aes-256-gcm";
keyformat = "passphrase";
#keylocation = "file:///tmp/secret.key";
keylocation = "prompt";
};
mountpoint = "/";
# README MORE: https://wiki.archlinux.org/title/ZFS#Swap_volume
"root/swap" = {
type = "zfs_volume";
size = "10M";
content = {
type = "swap";
}; };
options = { "root/nix" = {
volblocksize = "4096"; type = "zfs_fs";
compression = "zle"; options.mountpoint = "/nix";
logbias = "throughput"; mountpoint = "/nix";
sync = "always";
primarycache = "metadata";
secondarycache = "none";
"com.sun:auto-snapshot" = "false";
}; };
# # README MORE: https://wiki.archlinux.org/title/ZFS#Swap_volume
# "root/swap" = {
# type = "zfs_volume";
# size = "10M";
# content = {
# type = "swap";
# };
# options = {
# volblocksize = "4096";
# compression = "zle";
# logbias = "throughput";
# sync = "always";
# primarycache = "metadata";
# secondarycache = "none";
# "com.sun:auto-snapshot" = "false";
# };
# };
}; };
}; };
}; };