diff --git a/example/zfs-simple-root.nix b/example/zfs-simple-root.nix new file mode 100644 index 00000000..4bc8b061 --- /dev/null +++ b/example/zfs-simple-root.nix @@ -0,0 +1,73 @@ +{ + disko.devices = { + disk = { + disk1 = { + device = "/dev/disk/sdx"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "2G"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + zpool = { + rpool = { + type = "zpool"; + rootFsOptions = { + acltype = "posixacl"; + compression = "zstd"; + dnodesize = "auto"; + normalization = "formD"; + relatime = "on"; + xattr = "sa"; + }; + options = { + ashift = "12"; + autotrim = "on"; + }; + + datasets = { + "root" = { + type = "zfs_fs"; + options = { + mountpoint = "legacy"; + }; + mountpoint = "/"; + }; + "nix" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/nix"; + }; + "var" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/var"; + }; + "home" = { + type = "zfs_fs"; + mountpoint = "/home"; + options.mountpoint = "legacy"; + }; + }; + }; + }; + }; +} diff --git a/tests/make-disk-image-zfs.nix b/tests/make-disk-image-zfs.nix new file mode 100644 index 00000000..fcb598fc --- /dev/null +++ b/tests/make-disk-image-zfs.nix @@ -0,0 +1,26 @@ +{ + pkgs ? import { }, + ... +}: + +(pkgs.nixos [ + ../module.nix + ../example/zfs-simple-root.nix + ( + { config, ... }: + { + networking.hostId = "00000000"; + + # Adds some weight to the closure size to test real world usage + disko.devices.disk.disk1.imageSize = "5G"; + environment.systemPackages = with pkgs; [ + chromium + firefox + ]; + + documentation.enable = false; + system.stateVersion = config.system.nixos.release; + disko.checkScripts = true; + } + ) +]).config.system.build.diskoImages