diff --git a/configuration.nix b/configuration.nix index 20df6e1..a91ddf1 100644 --- a/configuration.nix +++ b/configuration.nix @@ -11,16 +11,27 @@ networking.hostName = "nix-nas"; networking.hostId = "39373132"; # via: head -c4 /etc/machine-id | od -An -tx4 - fileSystems = { - "/nix" = { - device = "rpool/nix"; + fileSystems."/" = + { device = "rpool/root"; fsType = "zfs"; }; - "/home" = { - device = "rpool/home"; + + fileSystems."/nix" = + { device = "rpool/nix"; fsType = "zfs"; }; - }; + + fileSystems."/home" = + { device = "tank/home"; + fsType = "zfs"; + }; + + fileSystems."/tank" = + { device = "tank/media"; + fsType = "zfs"; + }; + + swapDevices = [ ]; users.users.nicole = { isNormalUser = true; diff --git a/disko.nix b/disko.nix index 2b3c945..283e999 100644 --- a/disko.nix +++ b/disko.nix @@ -11,7 +11,7 @@ type = "gpt"; partitions = { ESP = { - size = "512M"; type = "EF00"; + size = "1G"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; @@ -20,11 +20,11 @@ }; }; rpool = { - size = "60G"; type = "BF00"; + size = "60G"; content = { type = "zfs"; pool = "rpool"; }; }; tank = { - type = "BF00"; + size = "100%"; content = { type = "zfs"; pool = "tank"; }; }; }; @@ -34,20 +34,25 @@ zpool.rpool = { type = "zpool"; options = { ashift = "12"; autotrim = "on"; }; + rootFsOptions = { + compression = "zstd"; + }; + postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^rpool@blank$' || zfs snapshot rpool@blank"; + datasets = { root = { type = "zfs_fs"; mountpoint = "/"; - options.compression = "zstd"; + options = { + mountpoint = "legacy"; + compression = "zstd"; + "com.sun:auto-snapshot" = "false"; + }; }; nix = { type = "zfs_fs"; - mountpoint = "legacy"; - options.compression = "zstd"; - }; - home = { - type = "zfs_fs"; - mountpoint = "legacy"; + mountpoint = "/nix"; + options.mountpoint = "legacy"; options.compression = "zstd"; }; }; @@ -56,10 +61,20 @@ zpool.tank = { type = "zpool"; options = { ashift = "12"; autotrim = "on"; }; - datasets.media = { - type = "zfs_fs"; - mountpoint = "/tank"; - options.compression = "zstd"; + postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^tank@blank$' || zfs snapshot tank@blank"; + datasets = { + media = { + type = "zfs_fs"; + mountpoint = "/tank"; + options.mountpoint = "legacy"; + options.compression = "zstd"; + }; + home = { + type = "zfs_fs"; + mountpoint = "/home"; + options.mountpoint = "legacy"; + options.compression = "zstd"; + }; }; }; }; diff --git a/flake.nix b/flake.nix index 7de6905..d1cdcde 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,7 @@ let system = "x86_64-linux"; in { - nixosConfigurations.host = nixpkgs.lib.nixosSystem { + nixosConfigurations.nix-nas = nixpkgs.lib.nixosSystem { inherit system; # ← Pflichtfeld specialArgs.disks = [ "/dev/nvme0n1" ]; modules = [