yggdrasil: zfs prep

This commit is contained in:
Christoph Hollizeck 2026-01-31 14:54:01 +01:00
parent e642a10ec2
commit 3f746987b3
Signed by: Daholli
GPG key ID: 249300664F2AF2C7
6 changed files with 245 additions and 79 deletions

View file

@ -1,12 +1,7 @@
{
config,
...
}:
let
in
{
flake.modules.nixos."hosts/loptland" =
{
config,
inputs,
lib,
pkgs,

View file

@ -29,6 +29,8 @@ topLevel: {
postman
vlc
ffmpeg
inputs.hytale-launcher.packages.x86_64-linux.default
];
services.teamviewer.enable = true;

View file

@ -0,0 +1,132 @@
{
flake.modules.nixos."hosts/yggdrasil" =
{
inputs,
...
}:
{
imports = [ inputs.disko.nixosModules.disko ];
boot.supportedFilesystems = [ "zfs" ];
networking.hostId = "007f0200";
services.zfs = {
autoScrub.enable = true;
autoSnapshot.enable = true;
trim.enable = true;
};
disko.devices = {
disk = {
x = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
y = {
type = "disk";
device = "/dev/nvme1n1";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
mode = "mirror";
options = {
ashift = "12";
autotrim = "on";
};
rootFsOptions = {
canmount = "off";
checksum = "edonr";
compression = "zstd";
dnodesize = "auto";
mountpoint = "none";
normalization = "formD";
relatime = "on";
"com.sun:auto-snapshot" = "false";
};
datasets = {
"local" = {
type = "zfs_fs";
options.mountpoint = "none";
};
"local/home" = {
type = "zfs_fs";
mountpoint = "/home";
options = {
"com.sun:auto-snapshot" = "true";
};
};
"local/steam" = {
type = "zfs_fs";
mountpoint = "/steam";
options = {
"com.sun:auto-snapshot" = "false";
recordsize = "1M";
compression = "lz4";
casesensitivity = "insensitive";
};
postCreateHook = "chown cholli:users /steam";
};
"local/nix" = {
type = "zfs_fs";
mountpoint = "/nix";
options."com.sun:auto-snapshot" = "false";
};
"local/persist" = {
type = "zfs_fs";
mountpoint = "/persist";
options."com.sun:auto-snapshot" = "true";
};
"local/root" = {
type = "zfs_fs";
mountpoint = "/";
options."com.sun:auto-snapshot" = "false";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/local/root@blank$' || zfs snapshot zroot/local/root@blank";
};
};
};
};
};
};
}

View file

@ -1,16 +1,18 @@
{
config,
...
}:
let
in
{
flake.modules.nixos."hosts/yggdrasil" =
{ lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
boot = {
zfs.package = pkgs.zfs_2_4;
kernelPackages = pkgs.linuxPackages_latest;
extraModulePackages = with config.boot.kernelPackages; [ r8125 ];
blacklistedKernelModules = [ "r8169" ];
loader = {
systemd-boot.enable = true;
@ -29,41 +31,6 @@ in
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/b1a956f4-91d5-456e-a92b-be505bb719bd";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-uuid/B4D4-8BA0";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
"/storage" = {
device = "/dev/disk/by-uuid/c3c1dec1-7716-4c37-a3f2-bb60f9af84fd";
fsType = "ext4";
};
"/var/lib/bluetooth" = {
device = "/persist/var/lib/bluetooth";
options = [
"bind"
"noauto"
"x-systemd.automount"
];
noCheck = true;
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/4bec00ec-e9eb-4034-836a-ecf15e0bb40e"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.enableRedistributableFirmware = true;
hardware.cpu.amd.updateMicrocode = true;