From b1b5e77f47f30987dde168c6a7757508ca6fa719 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 25 Feb 2023 10:22:24 -0500 Subject: [PATCH] back to disko module once again --- hosts/swan/default.nix | 2 +- hosts/swan/disks.nix | 326 +++++++++++++++++++++-------------------- 2 files changed, 165 insertions(+), 163 deletions(-) diff --git a/hosts/swan/default.nix b/hosts/swan/default.nix index 4be4e43..ba632f0 100644 --- a/hosts/swan/default.nix +++ b/hosts/swan/default.nix @@ -10,6 +10,7 @@ nixpkgs.lib.nixosSystem { specialArgs = { }; modules = [ ./hardware-configuration.nix + ./disks.nix ../../modules/common ../../modules/nixos (removeAttrs globals [ "mail.server" ]) @@ -17,7 +18,6 @@ nixpkgs.lib.nixosSystem { home-manager.nixosModules.home-manager disko.nixosModules.disko { - disko.devices = import ./disks.nix; server = true; gui.enable = false; theme = { colors = (import ../../colorscheme/gruvbox).dark; }; diff --git a/hosts/swan/disks.nix b/hosts/swan/disks.nix index cccf648..ffa1155 100644 --- a/hosts/swan/disks.nix +++ b/hosts/swan/disks.nix @@ -1,166 +1,168 @@ -{ - disk = { - boot = { - type = "disk"; - device = "/dev/nvme0n1"; - content = { - type = "table"; - format = "gpt"; - partitions = [ - { - type = "partition"; - name = "ESP"; - start = "0"; - end = "512MiB"; - fs-type = "fat32"; - bootable = true; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - } - { - type = "partition"; - name = "root"; - start = "512MiB"; - end = "100%"; - part-type = "primary"; - bootable = true; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - } - ]; - }; - }; - sda = { - type = "disk"; - device = "/dev/sda"; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - type = "partition"; - name = "zfs"; - start = "128MiB"; - end = "100%"; - content = { - type = "zfs"; - pool = "tank"; - }; - }]; - }; - }; - sdb = { - type = "disk"; - device = "/dev/sdb"; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - type = "partition"; - name = "zfs"; - start = "128MiB"; - end = "100%"; - content = { - type = "zfs"; - pool = "tank"; - }; - }]; - }; - }; - sdc = { - type = "disk"; - device = "/dev/sdc"; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - type = "partition"; - name = "zfs"; - start = "128MiB"; - end = "100%"; - content = { - type = "zfs"; - pool = "tank"; - }; - }]; - }; - }; - }; - zpool = { - tank = { - type = "zpool"; - mode = "raidz1"; - rootFsOptions = { - compression = "on"; # lz4 by default - "com.sun:auto-snapshot" = "false"; - ashift = 12; - }; - # mountpoint = "/"; - - datasets = { - media = { - zfs_type = "filesystem"; - mountpoint = "none"; - options."com.sun:auto-snapshot" = "false"; +{ ... }: { + disko.devices = { + disk = { + boot = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + name = "ESP"; + start = "0"; + end = "512MiB"; + fs-type = "fat32"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + type = "partition"; + name = "root"; + start = "512MiB"; + end = "100%"; + part-type = "primary"; + bootable = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + } + ]; + }; + }; + sda = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "table"; + format = "gpt"; + partitions = [{ + type = "partition"; + name = "zfs"; + start = "128MiB"; + end = "100%"; + content = { + type = "zfs"; + pool = "tank"; + }; + }]; + }; + }; + sdb = { + type = "disk"; + device = "/dev/sdb"; + content = { + type = "table"; + format = "gpt"; + partitions = [{ + type = "partition"; + name = "zfs"; + start = "128MiB"; + end = "100%"; + content = { + type = "zfs"; + pool = "tank"; + }; + }]; + }; + }; + sdc = { + type = "disk"; + device = "/dev/sdc"; + content = { + type = "table"; + format = "gpt"; + partitions = [{ + type = "partition"; + name = "zfs"; + start = "128MiB"; + end = "100%"; + content = { + type = "zfs"; + pool = "tank"; + }; + }]; + }; + }; + }; + zpool = { + tank = { + type = "zpool"; + mode = "raidz1"; + rootFsOptions = { + compression = "on"; # lz4 by default + "com.sun:auto-snapshot" = "false"; + ashift = "12"; + }; + # mountpoint = "/"; + + datasets = { + media = { + zfs_type = "filesystem"; + mountpoint = "/media"; + options."com.sun:auto-snapshot" = "false"; + }; + # "media/movies" = { + # zfs_type = "filesystem"; + # mountpoint = "/media/movies"; + # options.recordsize = "1M"; + # }; + # "media/tv" = { + # zfs_type = "filesystem"; + # mountpoint = "/media/tv"; + # options.recordsize = "1M"; + # }; + # "media/books" = { + # zfs_type = "filesystem"; + # mountpoint = "/media/books"; + # }; + # archive = { + # zfs_type = "filesystem"; + # mountpoint = "/archive"; + # options.compression = "zstd"; + # options."com.sun:auto-snapshot" = "true"; + # }; + # zfs_unmounted_fs = { + # zfs_type = "filesystem"; + # options.mountpoint = "none"; + # }; + # zfs_legacy_fs = { + # zfs_type = "filesystem"; + # options.mountpoint = "legacy"; + # mountpoint = "/zfs_legacy_fs"; + # }; + # zfs_testvolume = { + # zfs_type = "volume"; + # size = "10M"; + # content = { + # type = "filesystem"; + # format = "ext4"; + # mountpoint = "/ext4onzfs"; + # }; + # }; + # encrypted = { + # zfs_type = "filesystem"; + # size = "20M"; + # options = { + # mountpoint = "none"; + # encryption = "aes-256-gcm"; + # keyformat = "passphrase"; + # keylocation = "file:///tmp/secret.key"; + # }; + # }; + # "encrypted/test" = { + # zfs_type = "filesystem"; + # size = "2M"; + # mountpoint = "/zfs_crypted"; + # }; }; - # "media/movies" = { - # zfs_type = "filesystem"; - # mountpoint = "/media/movies"; - # options.recordsize = "1M"; - # }; - # "media/tv" = { - # zfs_type = "filesystem"; - # mountpoint = "/media/tv"; - # options.recordsize = "1M"; - # }; - # "media/books" = { - # zfs_type = "filesystem"; - # mountpoint = "/media/books"; - # }; - # archive = { - # zfs_type = "filesystem"; - # mountpoint = "/archive"; - # options.compression = "zstd"; - # options."com.sun:auto-snapshot" = "true"; - # }; - # zfs_unmounted_fs = { - # zfs_type = "filesystem"; - # options.mountpoint = "none"; - # }; - # zfs_legacy_fs = { - # zfs_type = "filesystem"; - # options.mountpoint = "legacy"; - # mountpoint = "/zfs_legacy_fs"; - # }; - # zfs_testvolume = { - # zfs_type = "volume"; - # size = "10M"; - # content = { - # type = "filesystem"; - # format = "ext4"; - # mountpoint = "/ext4onzfs"; - # }; - # }; - # encrypted = { - # zfs_type = "filesystem"; - # size = "20M"; - # options = { - # mountpoint = "none"; - # encryption = "aes-256-gcm"; - # keyformat = "passphrase"; - # keylocation = "file:///tmp/secret.key"; - # }; - # }; - # "encrypted/test" = { - # zfs_type = "filesystem"; - # size = "2M"; - # mountpoint = "/zfs_crypted"; - # }; }; }; };