nixbot

builds

failed treefmt-check default.checks.x86_64-linux.treefmt · build #6 · raw

1treefmt v2.4.1traversed 87 files2emitted 63 files for processing3formatted 63 files (3 changed) in 203ms4 M lib/zfs-storage/tests/eval-tests.nix5 M lib/zfs-storage/tests/flake-module.nix6 M lib/zfs-storage/tests/vm-runtime/service.nix7diff --git a/lib/zfs-storage/tests/eval-tests.nix b/lib/zfs-storage/tests/eval-tests.nix8index 2333693..88de88a 1006449--- a/lib/zfs-storage/tests/eval-tests.nix10+++ b/lib/zfs-storage/tests/eval-tests.nix11@@ -16,23 +16,25 @@ let12 # Used to evaluate raw inputs *through* the submodule types so that13 # defaults surface (owner, zfs, mode) exactly as a real consumer sees14 # them.15- mountsType = lib.types.attrsOf (lib.types.submodule {16- options = {17- path = lib.mkOption { type = lib.types.str; };18- mode = lib.mkOption {19- type = lib.types.str;20- default = "0750";21- };22- owner = lib.mkOption {23- type = zfsStorage.types.owner;24- default = { };25- };26- zfs = lib.mkOption {27- type = zfsStorage.types.zfs;28- default = { };29+ mountsType = lib.types.attrsOf (30+ lib.types.submodule {31+ options = {32+ path = lib.mkOption { type = lib.types.str; };33+ mode = lib.mkOption {34+ type = lib.types.str;35+ default = "0750";36+ };37+ owner = lib.mkOption {38+ type = zfsStorage.types.owner;39+ default = { };40+ };41+ zfs = lib.mkOption {42+ type = zfsStorage.types.zfs;43+ default = { };44+ };45 };46- };47- });48+ }49+ );50 51 evalMounts =52 raw:53@@ -50,7 +52,9 @@ let54 55 # A single fully-defaulted mount, used by the defaults tests.56 defaultedMounts = evalMounts {57- m = { path = "/x"; };58+ m = {59+ path = "/x";60+ };61 };62 in63 {64@@ -166,7 +170,9 @@ in65 };66 };67 # zfs.enable defaults to false → this entry must be dropped.68- drop = { path = "/srv/b"; };69+ drop = {70+ path = "/srv/b";71+ };72 });73 expected = {74 "srv-a" = {75@@ -188,32 +194,38 @@ in76 # ── mkDiskoDatasets key convention ────────────────────────────────77 78 testMkDiskoKey = {79- expr = builtins.attrNames (zfsStorage.mkDiskoDatasets (evalMounts {80- m = {81- path = "/srv/a";82- zfs = {83- enable = true;84- pool = "pool1";85- dataset = "data/a";86+ expr = builtins.attrNames (87+ zfsStorage.mkDiskoDatasets (evalMounts {88+ m = {89+ path = "/srv/a";90+ zfs = {91+ enable = true;92+ pool = "pool1";93+ dataset = "data/a";94+ };95 };96- };97- }));98+ })99+ );100 expected = [ "pool1/data/a" ];101 };102 103 # Disabled mount does not leak into mkDiskoDatasets output.104 testMkDiskoFiltersDisabled = {105- expr = builtins.attrNames (zfsStorage.mkDiskoDatasets (evalMounts {106- keep = {107- path = "/srv/a";108- zfs = {109- enable = true;110- pool = "p";111- dataset = "a";112+ expr = builtins.attrNames (113+ zfsStorage.mkDiskoDatasets (evalMounts {114+ keep = {115+ path = "/srv/a";116+ zfs = {117+ enable = true;118+ pool = "p";119+ dataset = "a";120+ };121 };122- };123- drop = { path = "/srv/b"; };124- }));125+ drop = {126+ path = "/srv/b";127+ };128+ })129+ );130 expected = [ "p/a" ];131 };132 133@@ -324,7 +336,9 @@ in134 dataset = "a";135 };136 };137- drop = { path = "/srv/b"; };138+ drop = {139+ path = "/srv/b";140+ };141 });142 expected = [ "d /srv/a 0750 app app -" ];143 };144@@ -345,7 +359,9 @@ in145 dataset = "a";146 };147 };148- off = { path = "/var/cache/app"; };149+ off = {150+ path = "/var/cache/app";151+ };152 });153 in154 builtins.sort (a: b: a.label < b.label) out;155diff --git a/lib/zfs-storage/tests/flake-module.nix b/lib/zfs-storage/tests/flake-module.nix156index 0130c40..3ef9e55 100644157--- a/lib/zfs-storage/tests/flake-module.nix158+++ b/lib/zfs-storage/tests/flake-module.nix159@@ -34,50 +34,49 @@ in160 nix-unit.tests.zfs-storage = import ./eval-tests.nix { inherit (pkgs) lib; };161 162 # `nix flake check` coverage.163- checks =164- {165- # Eval tests: force every assertion at Nix eval time. Mirrors the166- # `eval-tests-import-flake` pattern in `tests/flake-module.nix`.167- eval-tests-zfs-storage =168- let169- tests = import ./eval-tests.nix { inherit (pkgs) lib; };170- results = lib.mapAttrs (171- name: test:172- let173- pass = test.expr == test.expected;174- in175- if pass then176- "pass"177- else178- throw "eval test '${name}' failed:\n expr: ${builtins.toJSON test.expr}\n expected: ${builtins.toJSON test.expected}"179- ) tests;180- summary = lib.concatStringsSep "\n" (181- lib.mapAttrsToList (name: status: " ${name}: ${status}") results182- );183- in184- pkgs.runCommand "eval-tests-zfs-storage" { inherit summary; } ''185- echo "All zfs-storage eval tests passed:"186- echo "$summary"187- echo ""188- echo "${toString (builtins.length (builtins.attrNames tests))} tests passed."189- touch $out190- '';191- }192- # Test 2: build-only structural check that `mkDiskoDatasets` output193- # is a shape disko-zfs accepts. Forces `system.build.diskoScript` to194- # build; does NOT execute it. Linux-only because disko-zfs is Linux.195- // lib.optionalAttrs pkgs.stdenv.isLinux {196- zfs-storage-disko-build =197- let198- machine = inputs.nixpkgs.lib.nixosSystem {199- inherit system;200- modules = [ (import ./disko-build/machine.nix { inherit inputs; }) ];201- };202- in203- pkgs.runCommand "zfs-storage-disko-build" { } ''204- cp ${machine.config.system.build.diskoScript} $out205- '';206- };207+ checks = {208+ # Eval tests: force every assertion at Nix eval time. Mirrors the209+ # `eval-tests-import-flake` pattern in `tests/flake-module.nix`.210+ eval-tests-zfs-storage =211+ let212+ tests = import ./eval-tests.nix { inherit (pkgs) lib; };213+ results = lib.mapAttrs (214+ name: test:215+ let216+ pass = test.expr == test.expected;217+ in218+ if pass then219+ "pass"220+ else221+ throw "eval test '${name}' failed:\n expr: ${builtins.toJSON test.expr}\n expected: ${builtins.toJSON test.expected}"222+ ) tests;223+ summary = lib.concatStringsSep "\n" (224+ lib.mapAttrsToList (name: status: " ${name}: ${status}") results225+ );226+ in227+ pkgs.runCommand "eval-tests-zfs-storage" { inherit summary; } ''228+ echo "All zfs-storage eval tests passed:"229+ echo "$summary"230+ echo ""231+ echo "${toString (builtins.length (builtins.attrNames tests))} tests passed."232+ touch $out233+ '';234+ }235+ # Test 2: build-only structural check that `mkDiskoDatasets` output236+ # is a shape disko-zfs accepts. Forces `system.build.diskoScript` to237+ # build; does NOT execute it. Linux-only because disko-zfs is Linux.238+ // lib.optionalAttrs pkgs.stdenv.isLinux {239+ zfs-storage-disko-build =240+ let241+ machine = inputs.nixpkgs.lib.nixosSystem {242+ inherit system;243+ modules = [ (import ./disko-build/machine.nix { inherit inputs; }) ];244+ };245+ in246+ pkgs.runCommand "zfs-storage-disko-build" { } ''247+ cp ${machine.config.system.build.diskoScript} $out248+ '';249+ };250 251 # Test 1: VM, runtime side, no disko. Linux-only via the252 # `optionalAttrs pkgs.stdenv.isLinux` gate inside `clan-nixos-test.nix`.253diff --git a/lib/zfs-storage/tests/vm-runtime/service.nix b/lib/zfs-storage/tests/vm-runtime/service.nix254index 2e0050b..b92399c 100644255--- a/lib/zfs-storage/tests/vm-runtime/service.nix256+++ b/lib/zfs-storage/tests/vm-runtime/service.nix257@@ -23,23 +23,25 @@258 {259 options.mounts = lib.mkOption {260 default = { };261- type = lib.types.attrsOf (lib.types.submodule {262- options = {263- path = lib.mkOption { type = lib.types.str; };264- mode = lib.mkOption {265- type = lib.types.str;266- default = "0750";267+ type = lib.types.attrsOf (268+ lib.types.submodule {269+ options = {270+ path = lib.mkOption { type = lib.types.str; };271+ mode = lib.mkOption {272+ type = lib.types.str;273+ default = "0750";274+ };275+ owner = lib.mkOption {276+ type = zfsStorage.types.owner;277+ default = { };278+ };279+ zfs = lib.mkOption {280+ type = zfsStorage.types.zfs;281+ default = { };282+ };283 };284- owner = lib.mkOption {285- type = zfsStorage.types.owner;286- default = { };287- };288- zfs = lib.mkOption {289- type = zfsStorage.types.zfs;290- default = { };291- };292- };293- });294+ }295+ );296 };297 };298