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,9 +1,17 @@
{ lib, config, ... }:
{ {
options.device = lib.mkOption {
type = lib.types.str;
example = "/dev/nvme0n1";
};
config = {
disko.devices = { disko.devices = {
disk = { disk = {
root = { root = {
type = "disk"; type = "disk";
device = "/dev/vda"; device = config.device;
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
@ -57,22 +65,23 @@
mountpoint = "/nix"; mountpoint = "/nix";
}; };
# README MORE: https://wiki.archlinux.org/title/ZFS#Swap_volume # # README MORE: https://wiki.archlinux.org/title/ZFS#Swap_volume
"root/swap" = { # "root/swap" = {
type = "zfs_volume"; # type = "zfs_volume";
size = "10M"; # size = "10M";
content = { # content = {
type = "swap"; # type = "swap";
}; # };
options = { # options = {
volblocksize = "4096"; # volblocksize = "4096";
compression = "zle"; # compression = "zle";
logbias = "throughput"; # logbias = "throughput";
sync = "always"; # sync = "always";
primarycache = "metadata"; # primarycache = "metadata";
secondarycache = "none"; # secondarycache = "none";
"com.sun:auto-snapshot" = "false"; # "com.sun:auto-snapshot" = "false";
}; # };
# };
}; };
}; };
}; };