1
0
Fork 0
mirror of https://github.com/numtide/flake-utils.git synced 2024-12-14 11:47:31 +00:00

Add test to ensure no special handling of hydraJobs

This commit is contained in:
Jean-Baptiste Giraudeau 2023-05-31 17:23:27 +02:00
parent 9e0a97e026
commit 180473db90
No known key found for this signature in database
GPG key ID: 7CEF8C9CC2D9933B
2 changed files with 66 additions and 1 deletions

View file

@ -0,0 +1,56 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 0,
"narHash": "sha256-omjHh3LT883xERMxVEXH/oeAFI2pAAy30mhZb0eN5G4=",
"path": "../..",
"type": "path"
},
"original": {
"path": "../..",
"type": "path"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1685498995,
"narHash": "sha256-rdyjnkq87tJp+T2Bm1OD/9NXKSsh/vLlPeqCc/mm7qs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9cfaa8a1a00830d17487cb60a19bb86f96f09b27",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,19 +1,28 @@
{
description = "Flake utils demo";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.url = "path:../..";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (flake-utils.lib.check-utils system) isEqual hasKey;
testDataset = { key1 = "value1"; key2 = 123; key3 = "some>value with^invalid&characters"; };
mkHydraJobs = system: {
toplevel = derivation { name = "toplevel"; builder = "mybuilder"; inherit system; };
nested = {
attribute = derivation { name = "nested-attribute"; builder = "mybuilder"; inherit system; };
};
};
in
rec {
hydraJobs = mkHydraJobs system;
checks = {
# Successful cases
success_isEqual = isEqual testDataset.key1 "value1";
success_hasKey = hasKey testDataset "key2";
# ensure no special handling of hydraJobs
success_hydraJobs = isEqual self.hydraJobs (flake-utils.lib.eachDefaultSystemMap mkHydraJobs);
# Failing cases
failure_isEqual = isEqual testDataset.key1 "failing-data";