aboutsummaryrefslogtreecommitdiffstats
path: root/tests/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-12 02:36:21 +0000
committertv <tv@krebsco.de>2026-11-12 02:36:21 +0000
commit74fb1d515e6879922bc65fab4c7099dde9dd92e5 (patch)
tree650a07d3a31923e3c724f9e709ece39d05a2a506 /tests/default.nix
parentb0469337bd8eb3d8e325e82640ac855731975000 (diff)
tests: run populate's jq programs over lock files of both shapes
Depending on the version of Nix, lock files name subdirectories as attribute dir or as query parameter dir of the URL. The VM tests run one version, so only one shape gets covered there. The jq programs for flakes move to pkgs/populate/flake-jq.nix, and a new test, jq, runs them without VMs over lock files of both shapes, with follows, removed and cyclic follows, and inputs given by relative paths.
Diffstat (limited to 'tests/default.nix')
-rw-r--r--tests/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/default.nix b/tests/default.nix
index ca409b3..a6b9356 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -1,7 +1,8 @@
# NixOS VM tests for populate: one test per source type, one for features
# spanning sources, one for edge cases of flakes, and one for writeDeploy's
# arguments to nixos-rebuild. Build all with nix-build tests, or one with,
-# e.g., nix-build tests -A flake.
+# e.g., nix-build tests -A flake. jq runs populate's jq programs for flakes
+# without VMs.
{ pkgs ? import ../pkgs {} }:
let
@@ -21,7 +22,17 @@ let
agePath = "${pkgs.age}/bin/age";
inherit gitHead gitFirst;
};
+ flakeJq = import ../pkgs/populate/flake-jq.nix;
in
builtins.mapAttrs
(name: scenarios: import ./vm.nix { inherit pkgs name scenarios gitHead; })
scenarios
+ // {
+ # Lock files in the shapes different versions of Nix write.
+ jq = pkgs.runCommand "krops-jq" { nativeBuildInputs = [ pkgs.jq ]; } ''
+ sh ${./jq.sh} ${pkgs.linkFarm "krops-flake-jq" (map
+ (name: { name = "${name}.jq"; path = pkgs.writeText "${name}.jq" flakeJq.${name}; })
+ [ "selected" "selfIsRemote" "selfLocked" ])}
+ touch $out
+ '';
+ }