on iko/ghcjs-patch-master help sign in
always clean the source, no matter what (#1403)

* always clean the source, no matter what * update hydra

commit1ca99326b2e71d8e52bb64f7a7831011abec2f09 authorDavHau <hsngrmpf+github@gmail.com> dateFri 18 Mar 2022, 20:08 (5 years ago) parentb944c80
6 files changed+110−13
flake.lock+90 flake.nix+1 lib/call-cabal-project-to-nix.nix+10−12 overlays/default.nix+2 overlays/hydra.nix+5 scripts/check-hydra.nix+2−1
flake.lock+90
@@ -147,6 +147,65 @@
147147 "type": "github"
148148 }
149149 },
150+ "hydra": {
151+ "inputs": {
152+ "nix": "nix",
153+ "nixpkgs": [
154+ "hydra",
155+ "nix",
156+ "nixpkgs"
157+ ]
158+ },
159+ "locked": {
160+ "lastModified": 1646878427,
161+ "narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=",
162+ "owner": "NixOS",
163+ "repo": "hydra",
164+ "rev": "28b682b85b7efc5cf7974065792a1f22203a5927",
165+ "type": "github"
166+ },
167+ "original": {
168+ "id": "hydra",
169+ "type": "indirect"
170+ }
171+ },
172+ "lowdown-src": {
173+ "flake": false,
174+ "locked": {
175+ "lastModified": 1633514407,
176+ "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
177+ "owner": "kristapsdz",
178+ "repo": "lowdown",
179+ "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
180+ "type": "github"
181+ },
182+ "original": {
183+ "owner": "kristapsdz",
184+ "repo": "lowdown",
185+ "type": "github"
186+ }
187+ },
188+ "nix": {
189+ "inputs": {
190+ "lowdown-src": "lowdown-src",
191+ "nixpkgs": "nixpkgs",
192+ "nixpkgs-regression": "nixpkgs-regression"
193+ },
194+ "locked": {
195+ "lastModified": 1643066034,
196+ "narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=",
197+ "owner": "NixOS",
198+ "repo": "nix",
199+ "rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62",
200+ "type": "github"
201+ },
202+ "original": {
203+ "owner": "NixOS",
204+ "ref": "2.6.0",
205+ "repo": "nix",
206+ "type": "github"
207+ }
208+ },
150209 "nix-tools": {
151210 "flake": false,
152211 "locked": {
@@ -163,6 +222,21 @@
163222 "type": "github"
164223 }
165224 },
225+ "nixpkgs": {
226+ "locked": {
227+ "lastModified": 1632864508,
228+ "narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
229+ "owner": "NixOS",
230+ "repo": "nixpkgs",
231+ "rev": "82891b5e2c2359d7e58d08849e4c89511ab94234",
232+ "type": "github"
233+ },
234+ "original": {
235+ "id": "nixpkgs",
236+ "ref": "nixos-21.05-small",
237+ "type": "indirect"
238+ }
239+ },
166240 "nixpkgs-2003": {
167241 "locked": {
168242 "lastModified": 1620055814,
@@ -211,6 +285,21 @@
211285 "type": "github"
212286 }
213287 },
288+ "nixpkgs-regression": {
289+ "locked": {
290+ "lastModified": 1643052045,
291+ "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
292+ "owner": "NixOS",
293+ "repo": "nixpkgs",
294+ "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
295+ "type": "github"
296+ },
297+ "original": {
298+ "id": "nixpkgs",
299+ "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
300+ "type": "indirect"
301+ }
302+ },
214303 "nixpkgs-unstable": {
215304 "locked": {
216305 "lastModified": 1644486793,
@@ -255,6 +344,7 @@
255344 "ghc-8.6.5-iohk": "ghc-8.6.5-iohk",
256345 "hackage": "hackage",
257346 "hpc-coveralls": "hpc-coveralls",
347+ "hydra": "hydra",
258348 "nix-tools": "nix-tools",
259349 "nixpkgs": [
260350 "nixpkgs-unstable"
flake.nix+1
@@ -8,6 +8,7 @@
88 nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; };
99 nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
1010 flake-utils = { url = "github:numtide/flake-utils"; };
11+ hydra.url = "hydra";
1112 hackage = {
1213 url = "github:input-output-hk/hackage.nix";
1314 flake = false;
lib/call-cabal-project-to-nix.nix+10−12
@@ -103,15 +103,13 @@ let
103103 ghc = ghc';
104104 subDir' = src.origSubDir or "";
105105 subDir = pkgs.lib.strings.removePrefix "/" subDir';
106− maybeCleanedSource =
107− if haskellLib.canCleanSource src
108− then (haskellLib.cleanSourceWith {
109− name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files";
110− src = src.origSrc or src;
111− filter = path: type: (!(src ? filter) || src.filter path type) && (
112− type == "directory" ||
113− pkgs.lib.any (i: (pkgs.lib.hasSuffix i path)) [ ".cabal" "package.yaml" ]); })
114− else src.origSrc or src;
106+
107+ cleanedSource = haskellLib.cleanSourceWith {
108+ name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files";
109+ src = src.origSrc or src;
110+ filter = path: type: (!(src ? filter) || src.filter path type) && (
111+ type == "directory" ||
112+ pkgs.lib.any (i: (pkgs.lib.hasSuffix i path)) [ ".cabal" "package.yaml" ]); };
115113
116114 # Using origSrcSubDir bypasses any cleanSourceWith so that it will work when
117115 # access to the store is restricted. If origSrc was already in the store
@@ -473,17 +471,17 @@ let
473471 } ''
474472 tmp=$(mktemp -d)
475473 cd $tmp
476− # if maybeCleanedSource is empty, this means it's a new
474+ # if cleanedSource is empty, this means it's a new
477475 # project where the files haven't been added to the git
478476 # repo yet. We fail early and provide a useful error
479477 # message to prevent headaches (#290).
480− if [ -z "$(ls -A ${maybeCleanedSource})" ]; then
478+ if [ -z "$(ls -A ${cleanedSource})" ]; then
481479 echo "cleaned source is empty. Did you forget to 'git add -A'?"
482480 ${pkgs.lib.optionalString (__length fixedProject.sourceRepos == 0) ''
483481 exit 1
484482 ''}
485483 else
486− cp -r ${maybeCleanedSource}/* .
484+ cp -r ${cleanedSource}/* .
487485 fi
488486 chmod +w -R .
489487 # Decide what to do for each `package.yaml` file.
overlays/default.nix+2
@@ -10,6 +10,7 @@ let
1010 bootstrap = import ./bootstrap.nix;
1111 ghc = import ./ghc.nix;
1212 ghc-packages = import ./ghc-packages.nix;
13+ hydra = import ./hydra.nix args;
1314 darwin = import ./darwin.nix;
1415 windows = import ./windows.nix;
1516 armv6l-linux = import ./armv6l-linux.nix;
@@ -56,6 +57,7 @@ let
5657 gobject-introspection
5758 hix
5859 eval-packages
60+ hydra
5961 # Restore nixpkgs haskell and haskellPackages
6062 (_: prev: { inherit (prev.haskell-nix-prev) haskell haskellPackages; })
6163 ];
overlays/hydra.nixnew file+5
@@ -0,0 +1,5 @@
1+{ sources, ...}:
2+
3+final: prev: {
4+ hydra-unstable = sources.hydra.defaultPackage.${prev.system};
5+}
scripts/check-hydra.nix+2−1
@@ -8,6 +8,7 @@ writeScript "check-hydra.sh" ''
88 set -euo pipefail
99
1010 export PATH="${makeBinPath [ coreutils time gnutar gzip hydra-unstable jq gitMinimal ]}"
11+ export NIX_PATH=
1112
1213 echo '~~~ Evaluating release.nix with --arg ifdLevel '$1
1314 command time --format '%e' -o eval-time.txt \
@@ -15,7 +16,7 @@ writeScript "check-hydra.sh" ''
1516 --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
1617 --arg supportedSystems '[ builtins.currentSystem ]' \
1718 --arg ifdLevel $1 \
18− -I . release.nix > eval.json
19+ -I $(realpath .) release.nix > eval.json
1920 EVAL_EXIT_CODE="$?"
2021 if [ "$EVAL_EXIT_CODE" != 0 ]
2122 then