diff --git a/flake.lock b/flake.lock index 7e9f4d56b58..740c24cb022 100644 --- a/flake.lock +++ b/flake.lock @@ -119,7 +119,7 @@ }, "easy-purescript-nix": { "inputs": { - "flake-utils": "flake-utils" + "flake-utils": "flake-utils_2" }, "locked": { "lastModified": 1710161569, @@ -187,6 +187,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1685518550, "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", @@ -201,9 +219,9 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_3": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1731533236, @@ -219,9 +237,9 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_4": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1710146030, @@ -563,7 +581,7 @@ ], "easy-purescript-nix": "easy-purescript-nix", "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "hackage": [ "hackage" ], @@ -673,7 +691,7 @@ }, "nix2container": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -970,6 +988,7 @@ "root": { "inputs": { "CHaP": "CHaP", + "flake-utils": "flake-utils", "hackage": "hackage", "haskell-nix": "haskell-nix", "iogx": "iogx", @@ -1093,6 +1112,21 @@ "repo": "default", "type": "github" } + }, + "systems_4": { + "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", diff --git a/flake.nix b/flake.nix index 858647c425c..1438d62c199 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,8 @@ url = "github:input-output-hk/haskell.nix"; inputs.hackage.follows = "hackage"; }; + + flake-utils.url = "github:numtide/flake-utils"; }; outputs = inputs: @@ -39,9 +41,11 @@ }; nixConfig = { - extra-substituters = [ "https://cache.iog.io" ]; - extra-trusted-public-keys = - [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; + extra-substituters = [ "https://cache.iog.io" "https://cache.garnix.io" ]; + extra-trusted-public-keys = [ + "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + ]; allow-import-from-derivation = true; }; } diff --git a/garnix.yaml b/garnix.yaml new file mode 100644 index 00000000000..c36133d5b4e --- /dev/null +++ b/garnix.yaml @@ -0,0 +1,5 @@ +builds: + # TODO once we have fully migrated from hydra to garnix, refactor nix/output.nix + # by removing all references to hydraJobs and populating this `include` section. + include: + - 'checks.*.*' \ No newline at end of file diff --git a/nix/outputs.nix b/nix/outputs.nix index 702b64289a2..a1baf828106 100644 --- a/nix/outputs.nix +++ b/nix/outputs.nix @@ -11,9 +11,11 @@ let ghc810 = project.variants.ghc810; ghc910 = project.variants.ghc910; -in [ +in +[ { inherit (project) cabalProject; + inherit project repoRoot; devShells.default = ghc96.devShell; devShells.profiled = ghc96-profiled.devShell; @@ -24,7 +26,7 @@ in [ packages = ghc96.packages; apps = ghc96.apps; - checks = ghc96.checks; + # checks = ghc96.checks; latex-documents = repoRoot.nix.latex-documents; @@ -37,7 +39,7 @@ in [ } (lib.optionalAttrs (system == "x86_64-linux" || system == "x86_64-darwin") { - hydraJobs.plutus-metatheory-site = repoRoot.nix.plutus-metatheory-site; + packages.plutus-metatheory-site = repoRoot.nix.plutus-metatheory-site; hydraJobs.ghc96 = ghc96.hydraJobs; hydraJobs.ghc810 = ghc810.hydraJobs; @@ -63,7 +65,7 @@ in [ (lib.optionalAttrs (system == "aarch64-darwin") { # Plausibly if things build on x86 darwin then they'll build on aarch darwin. - # Se we only build roots and dev sshells on aarch to avoid overloading the builders. + # Se we only build roots and dev shells on aarch to avoid overloading the builders. hydraJobs.ghc810.devShell = ghc810.devShell; hydraJobs.ghc96.devShell = ghc96.devShell; hydraJobs.ghc98.devShell = ghc98.devShell; @@ -81,4 +83,8 @@ in [ hydraJobs.ghc910.roots = ghc910.hydraJobs.roots; hydraJobs.ghc910.plan-nix = ghc910.hydraJobs.plan-nix; }) + { + checks = repoRoot.nix.utils.flattenDerivationTree "ci" "-" + inputs.self.hydraJobs.${system}; + } ] diff --git a/nix/utils.nix b/nix/utils.nix new file mode 100644 index 00000000000..e0fd1cf332c --- /dev/null +++ b/nix/utils.nix @@ -0,0 +1,15 @@ +{ repoRoot, inputs, pkgs, system, lib }: { + + flattenDerivationTree = prefix: separator: set: + let + recurse = name: name': + flatten (if name == "" then name' else "${name}${separator}${name'}"); + + flatten = name: value: + if lib.isDerivation value || lib.typeOf value != "set" then [{ + inherit name value; + }] else + lib.concatLists (lib.mapAttrsToList (recurse name) value); + + in assert lib.typeOf set == "set"; lib.listToAttrs (flatten prefix set); +}