diff --git a/hosts/franz/default.nix b/hosts/franz/default.nix index 3c8db81..89945c7 100644 --- a/hosts/franz/default.nix +++ b/hosts/franz/default.nix @@ -14,6 +14,7 @@ in { ./hardware-configuration.nix (import ../../disko/btrfs-swap.nix {device = "/dev/nvme0n1";}) + ./disko/zfs.nix ../common/global @@ -25,6 +26,16 @@ in { ./arion ]; + # Enable ZFS + boot.supportedFilesystems = ["zfs"]; + networking.hostId = "f014fc43"; + + systemd.enableEmergencyMode = false; + + # Prevent zfs from being automounted by fstab auto discovery & zfs + fileSystems."/storage/dataset".options = ["noauto"]; + fileSystems."/storage".options = ["noauto"]; + users.mutableUsers = true; users.users.${vars.user} = { password = "changeme"; @@ -38,10 +49,6 @@ in { }; security.pam.enableSSHAgentAuth = true; - fileSystems."/drives/hdd" = { - device = "/dev/disk/by-uuid/7d5eaff7-c17d-4fac-b7d7-7aa3c35b9a29"; - }; - nixpkgs = { overlays = [ outputs.overlays.additions diff --git a/hosts/franz/disko/zfs.nix b/hosts/franz/disko/zfs.nix new file mode 100644 index 0000000..056fb7f --- /dev/null +++ b/hosts/franz/disko/zfs.nix @@ -0,0 +1,120 @@ +{ + disko.devices = { + disk = { + a = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "storage"; + }; + }; + }; + }; + }; + b = { + type = "disk"; + device = "/dev/sdb"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "storage"; + }; + }; + }; + }; + }; + c = { + type = "disk"; + device = "/dev/sdc"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "storage"; + }; + }; + }; + }; + }; + d = { + type = "disk"; + device = "/dev/sdd"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "storage"; + }; + }; + }; + }; + }; + e = { + type = "disk"; + device = "/dev/sde"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "storage"; + }; + }; + }; + }; + }; + f = { + type = "disk"; + device = "/dev/sdf"; + content = { + type = "gpt"; + partitions = { + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "storage"; + }; + }; + }; + }; + }; + }; + zpool = { + storage = { + type = "zpool"; + mode = "raidz2"; + mountpoint = "/storage"; + datasets = { + dataset = { + type = "zfs_fs"; + mountpoint = "/storage/dataset"; + options = { + encryption = "on"; + keyformat = "hex"; + keylocation = "file:///home/ghoscht/.zfs/secret.key"; + }; + }; + }; + }; + }; + }; +}