diff --git a/flake.lock b/flake.lock index 51b3cd6ca2..11d47b8cac 100644 --- a/flake.lock +++ b/flake.lock @@ -147,6 +147,65 @@ "type": "github" } }, + "hydra": { + "inputs": { + "nix": "nix", + "nixpkgs": [ + "hydra", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646878427, + "narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=", + "owner": "NixOS", + "repo": "hydra", + "rev": "28b682b85b7efc5cf7974065792a1f22203a5927", + "type": "github" + }, + "original": { + "id": "hydra", + "type": "indirect" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1643066034, + "narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=", + "owner": "NixOS", + "repo": "nix", + "rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "2.6.0", + "repo": "nix", + "type": "github" + } + }, "nix-tools": { "flake": false, "locked": { @@ -163,6 +222,21 @@ "type": "github" } }, + "nixpkgs": { + "locked": { + "lastModified": 1632864508, + "narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "82891b5e2c2359d7e58d08849e4c89511ab94234", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.05-small", + "type": "indirect" + } + }, "nixpkgs-2003": { "locked": { "lastModified": 1620055814, @@ -211,6 +285,21 @@ "type": "github" } }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "indirect" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1644486793, @@ -255,6 +344,7 @@ "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", "hackage": "hackage", "hpc-coveralls": "hpc-coveralls", + "hydra": "hydra", "nix-tools": "nix-tools", "nixpkgs": [ "nixpkgs-unstable" diff --git a/flake.nix b/flake.nix index 1a368b96a5..9165746764 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,7 @@ nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; }; nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; flake-utils = { url = "github:numtide/flake-utils"; }; + hydra.url = "hydra"; hackage = { url = "github:input-output-hk/hackage.nix"; flake = false; diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 5461486712..2a4b670e37 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -103,15 +103,13 @@ let ghc = ghc'; subDir' = src.origSubDir or ""; subDir = pkgs.lib.strings.removePrefix "/" subDir'; - maybeCleanedSource = - if haskellLib.canCleanSource src - then (haskellLib.cleanSourceWith { - name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files"; - src = src.origSrc or src; - filter = path: type: (!(src ? filter) || src.filter path type) && ( - type == "directory" || - pkgs.lib.any (i: (pkgs.lib.hasSuffix i path)) [ ".cabal" "package.yaml" ]); }) - else src.origSrc or src; + + cleanedSource = haskellLib.cleanSourceWith { + name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files"; + src = src.origSrc or src; + filter = path: type: (!(src ? filter) || src.filter path type) && ( + type == "directory" || + pkgs.lib.any (i: (pkgs.lib.hasSuffix i path)) [ ".cabal" "package.yaml" ]); }; # Using origSrcSubDir bypasses any cleanSourceWith so that it will work when # access to the store is restricted. If origSrc was already in the store @@ -473,17 +471,17 @@ let } '' tmp=$(mktemp -d) cd $tmp - # if maybeCleanedSource is empty, this means it's a new + # if cleanedSource is empty, this means it's a new # project where the files haven't been added to the git # repo yet. We fail early and provide a useful error # message to prevent headaches (#290). - if [ -z "$(ls -A ${maybeCleanedSource})" ]; then + if [ -z "$(ls -A ${cleanedSource})" ]; then echo "cleaned source is empty. Did you forget to 'git add -A'?" ${pkgs.lib.optionalString (__length fixedProject.sourceRepos == 0) '' exit 1 ''} else - cp -r ${maybeCleanedSource}/* . + cp -r ${cleanedSource}/* . fi chmod +w -R . # Decide what to do for each `package.yaml` file. diff --git a/overlays/default.nix b/overlays/default.nix index 6a37002324..92157724b3 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -10,6 +10,7 @@ let bootstrap = import ./bootstrap.nix; ghc = import ./ghc.nix; ghc-packages = import ./ghc-packages.nix; + hydra = import ./hydra.nix args; darwin = import ./darwin.nix; windows = import ./windows.nix; armv6l-linux = import ./armv6l-linux.nix; @@ -56,6 +57,7 @@ let gobject-introspection hix eval-packages + hydra # Restore nixpkgs haskell and haskellPackages (_: prev: { inherit (prev.haskell-nix-prev) haskell haskellPackages; }) ]; diff --git a/overlays/hydra.nix b/overlays/hydra.nix new file mode 100644 index 0000000000..7ba918fd91 --- /dev/null +++ b/overlays/hydra.nix @@ -0,0 +1,5 @@ +{ sources, ...}: + +final: prev: { + hydra-unstable = sources.hydra.defaultPackage.${prev.system}; +} diff --git a/scripts/check-hydra.nix b/scripts/check-hydra.nix index 4a56058aae..110c83cb82 100644 --- a/scripts/check-hydra.nix +++ b/scripts/check-hydra.nix @@ -8,6 +8,7 @@ writeScript "check-hydra.sh" '' set -euo pipefail export PATH="${makeBinPath [ coreutils time gnutar gzip hydra-unstable jq gitMinimal ]}" + export NIX_PATH= echo '~~~ Evaluating release.nix with --arg ifdLevel '$1 command time --format '%e' -o eval-time.txt \ @@ -15,7 +16,7 @@ writeScript "check-hydra.sh" '' --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \ --arg supportedSystems '[ builtins.currentSystem ]' \ --arg ifdLevel $1 \ - -I . release.nix > eval.json + -I $(realpath .) release.nix > eval.json EVAL_EXIT_CODE="$?" if [ "$EVAL_EXIT_CODE" != 0 ] then