on iko/ghcjs-patch-master help sign in
Remove some flake specifics that can mess-up caching. (#1176)

* Remove flake specific sourceOverride that mess-up caching. * Reduce evalPackages discrepency between flake/non-flake. * Remove dependency on <nixpkgs> when importing sources.nix

commit531c9f4cac0e335db245849df3b5036973826d36 authorJean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io> dateWed 28 Jul 2021, 02:38 (5 years ago) parent97421c9
6 files changed+14−29
default.nix+2−9 flake.nix+1−7 nix/sources.json+1−1 overlays/default.nix+1−1 overlays/eval-packages.nix+6−8 overlays/haskell.nix+3−3
default.nix+2−9
@@ -2,7 +2,7 @@
22, system ? builtins.currentSystem
33, sourcesOverride ? {}
44, ... }@args: rec {
5− sources = (import ./nix/sources.nix) // sourcesOverride;
5+ sources = (import ./nix/sources.nix { inherit pkgs; }) // sourcesOverride;
66 config = import ./config.nix;
77 overlays = [ allOverlays.combined ] ++ (
88 if checkMaterialization == true
@@ -14,14 +14,7 @@
1414 }
1515 )]
1616 else []
17− ) ++ [(
18− final: prev: {
19− haskell-nix = prev.haskell-nix // {
20− inherit overlays;
21− sources = prev.haskell-nix.sources // sourcesOverride;
22− };
23− }
24− )];
17+ );
2518 allOverlays = import ./overlays args;
2619 nixpkgsArgs = { inherit config overlays system; };
2720 pkgs = import sources.nixpkgs nixpkgsArgs;
flake.nix+1−7
@@ -14,21 +14,15 @@
1414
1515 internal = rec {
1616 config = import ./config.nix;
17− # Use a shim for pkgs that does not depend on `builtins.currentSystem`.
18− sources = import ./nix/sources.nix {
19− pkgs = { fetchzip = builtins.fetchTarball; };
20− };
2117
2218 nixpkgsArgs = {
2319 inherit config;
2420 overlays = [ self.overlay ];
2521 };
26−
27− overlaysOverrideable = import ./overlays;
2822 };
2923
3024 overlay = self.overlays.combined;
31− overlays = self.internal.overlaysOverrideable { sourcesOverride = self.internal.sources; };
25+ overlays = import ./overlays {};
3226
3327 legacyPackages = let
3428 genAttrs = lst: f:
nix/sources.json+1−1
@@ -92,7 +92,7 @@
9292 },
9393 "nixpkgs": {
9494 "branch": "nixpkgs-21.05-darwin",
95− "builtin": false,
95+ "builtin": true,
9696 "description": "Nix Packages collection",
9797 "homepage": null,
9898 "owner": "NixOS",
overlays/default.nix+1−1
@@ -19,7 +19,7 @@ let
1919 nix-prefetch-git-minimal = import ./nix-prefetch-git-minimal.nix;
2020 gobject-introspection = import ./gobject-introspection.nix;
2121 hix = import ./hix.nix;
22− eval-packages = import ./eval-packages.nix;
22+ eval-packages = import ./eval-packages.nix combined;
2323 ghcjs = import ./ghcjs.nix;
2424 };
2525
overlays/eval-packages.nix+6−8
@@ -1,4 +1,4 @@
1−final: prev: {
1+haskellNixOverlay: final: prev: {
22 # This overlay makes `evalPackages` is like `buildPackages`, but on
33 # `builtins.currentSystem` (when not building a nix flake).
44 # We do not pass the `config` or `overlays` (not in `final.haskell-nix.overlays`).
@@ -6,11 +6,9 @@ final: prev: {
66 # derivations that use `evalPackages` (these should be eval time only derviations
77 # used to build nix inputs for IFD, the generated nix should match and so derivations
88 # that depend on the IFD should match).
9− evalPackages =
9+ evalPackages = (import final.path {
1010 # If we are building a flake there will be no currentSystem attribute
11− if builtins ? currentSystem
12− then (import final.path {
13− inherit (final.haskell-nix) overlays;
14− }).buildPackages
15− else final.buildPackages;
16−}
11+ system = builtins.currentSystem or final.system;
12+ overlays = [ haskellNixOverlay ];
13+ }).buildPackages;
14+}
overlays/haskell.nix+3−3
@@ -30,7 +30,7 @@ final: prev: {
3030 specJSON = stackageSourceJSON;
3131 override = "stackage";
3232 };
33− } // (import ../nix/sources.nix) // sourcesOverride;
33+ } // (import ../nix/sources.nix { pkgs = final; }) // sourcesOverride;
3434
3535 # We provide a `callPackage` function to consumers for
3636 # convenience. We will however refrain from using it
@@ -706,7 +706,7 @@ final: prev: {
706706 , crossPlatforms ? p: []
707707 }:
708708 let packageNames = project: builtins.attrNames (packages project.hsPkgs);
709− packagesForProject = prefix: project:
709+ packagesForProject = prefix: project:
710710 final.lib.concatMap (packageName:
711711 let package = project.hsPkgs.${packageName};
712712 in final.lib.optional (package.components ? library)
@@ -721,7 +721,7 @@ final: prev: {
721721 { name = "${prefix}${packageName}:test:${n}"; value = v; })
722722 (package.components.tests)
723723 ) (packageNames project);
724− checksForProject = prefix: project:
724+ checksForProject = prefix: project:
725725 final.lib.concatMap (packageName:
726726 let package = project.hsPkgs.${packageName};
727727 in final.lib.mapAttrsToList (n: v: