on iko/ghcjs-patch-master help sign in
Rename pkg-def-overlays to pkg-def-extras (#79)
8ee6fcfMoritz Angermann
@@ -55,7 +55,7 @@ let
55 # and Nix expressions representing cabal packages (cabal-to-nix).
55 # and Nix expressions representing cabal packages (cabal-to-nix).
56 mkPkgSet =
56 mkPkgSet =
57 { pkg-def # Base package set. Either from stackage (via stack-to-nix) or from a cabal projects plan file (via plan-to-nix)
57 { pkg-def # Base package set. Either from stackage (via stack-to-nix) or from a cabal projects plan file (via plan-to-nix)
58− , pkg-def-overlays ? [] # Additional packages to augment the Base package set `pkg-def` with.
58+ , pkg-def-extras ? [] # Additional packages to augment the Base package set `pkg-def` with.
59 , modules ? []
59 , modules ? []
60 }@args:
60 }@args:
61
61
@@ -67,7 +67,7 @@ let
67 # Create a Haskell package set based on a Stack configuration.
67 # Create a Haskell package set based on a Stack configuration.
68 mkStackPkgSet =
68 mkStackPkgSet =
69 { stack-pkgs # Path to the output of stack-to-nix
69 { stack-pkgs # Path to the output of stack-to-nix
70− , pkg-def-overlays ? []
70+ , pkg-def-extras ? []
71 , modules ? []
71 , modules ? []
72 }@args:
72 }@args:
73
73
@@ -75,27 +75,27 @@ let
75 # The Stackage release referenced in the stack config
75 # The Stackage release referenced in the stack config
76 pkg-def = stackage.${stack-pkgs.resolver};
76 pkg-def = stackage.${stack-pkgs.resolver};
77 # The compiler referenced in the stack config
77 # The compiler referenced in the stack config
78− compiler = (stack-pkgs.overlay hackage).compiler or (pkg-def hackage).compiler;
78+ compiler = (stack-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
79 in self.mkPkgSet {
79 in self.mkPkgSet {
80 inherit pkg-def;
80 inherit pkg-def;
81− pkg-def-overlays = [ stack-pkgs.overlay ] ++ pkg-def-overlays;
81+ pkg-def-extras = [ stack-pkgs.extras ] ++ pkg-def-extras;
82 modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
82 modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
83 };
83 };
84
84
85 # Create a Haskell package set based on a Cabal configuration.
85 # Create a Haskell package set based on a Cabal configuration.
86 mkCabalProjectPkgSet =
86 mkCabalProjectPkgSet =
87 { plan-pkgs # Path to the output of plan-to-nix
87 { plan-pkgs # Path to the output of plan-to-nix
88− , pkg-def-overlays ? []
88+ , pkg-def-extras ? []
89 , modules ? []
89 , modules ? []
90 }@args:
90 }@args:
91
91
92 let
92 let
93 pkg-def = plan-pkgs.pkgs;
93 pkg-def = plan-pkgs.pkgs;
94 # The compiler referenced in the stack config
94 # The compiler referenced in the stack config
95− compiler = (plan-pkgs.overlay hackage).compiler or (pkg-def hackage).compiler;
95+ compiler = (plan-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
96 in self.mkPkgSet {
96 in self.mkPkgSet {
97 inherit pkg-def;
97 inherit pkg-def;
98− pkg-def-overlays = [ plan-pkgs.overlay ] ++ pkg-def-overlays;
98+ pkg-def-extras = [ plan-pkgs.extras ] ++ pkg-def-extras;
99 modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
99 modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
100 };
100 };
101
101
docs/iohk-nix.md+7−7
@@ -41,7 +41,7 @@ iohk-nix.json
41nix/pkgs.nix
41nix/pkgs.nix
42```
42```
43{ pkgs ? import <nixpkgs> {}
43{ pkgs ? import <nixpkgs> {}
44−, iohk-overlay ? {}
44+, iohk-extras ? {}
45, iohk-module ? {}
45, iohk-module ? {}
46, haskell
46, haskell
47, hackage
47, hackage
@@ -67,16 +67,16 @@ let
67 # packages.cbors.patches = [ ./one.patch ];
67 # packages.cbors.patches = [ ./one.patch ];
68 # packages.cbors.flags.optimize-gmp = false;
68 # packages.cbors.flags.optimize-gmp = false;
69 #
69 #
70− compiler = (stack-pkgs.overlay hackage).compiler.nix-name;
70+ compiler = (stack-pkgs.extras hackage).compiler.nix-name;
71 pkgSet = haskell.mkNewPkgSet {
71 pkgSet = haskell.mkNewPkgSet {
72 inherit pkgs;
72 inherit pkgs;
73 pkg-def = stackage.${stack-pkgs.resolver};
73 pkg-def = stackage.${stack-pkgs.resolver};
74− # The overlay allows extension or restriction of the set of
74+ # These extras allow extension or restriction of the set of
75− # packages we are interested in. By using the stack-pkgs.overlay
75+ # packages we are interested in. By using the stack-pkgs.extras
76 # we restrict our package set to the ones provided in stack.yaml.
76 # we restrict our package set to the ones provided in stack.yaml.
77− pkg-def-overlays = [
77+ pkg-def-extras = [
78− stack-pkgs.overlay
78+ stack-pkgs.extras
79− iohk-overlay.${compiler}
79+ iohk-extras.${compiler}
80 ];
80 ];
81 # package customizations
81 # package customizations
82 modules = [
82 modules = [
docs/user-guide-cabal.md+1−1
@@ -50,7 +50,7 @@ file as follows:
50```nix
50```nix
51let plan = import ./plan.nix; in
51let plan = import ./plan.nix; in
52{ pkg-def = plan;
52{ pkg-def = plan;
53− overlay =
53+ extras =
54 { local-package-a = ./local-package-a.nix;
54 { local-package-a = ./local-package-a.nix;
55 local-package-b = ./local-package-b.nix;
55 local-package-b = ./local-package-b.nix;
56 source-import-a = ./source-import-a.nix;
56 source-import-a = ./source-import-a.nix;
docs/user-guide-stack.md+4−4
@@ -17,7 +17,7 @@ This will produce a `nix/pkgs.nix` file that looks like the following:
17```nix
17```nix
18{
18{
19 resolver = "lts-12.17";
19 resolver = "lts-12.17";
20− overlay = hackage:
20+ extras = hackage:
21 {
21 {
22 packages = {
22 packages = {
23 "o-clock" = hackage.o-clock."0.1.1".revisions.default;
23 "o-clock" = hackage.o-clock."0.1.1".revisions.default;
@@ -30,9 +30,9 @@ This will produce a `nix/pkgs.nix` file that looks like the following:
30}
30}
31```
31```
32
32
33−This file contains the stackage resolver, as well as an overlay of
33+This file contains the stackage resolver, as well as set of extra
34−packages. The overlay specifies which `extra-deps` (here: o-clock-0.1.1)
34+packages. The extras specifies which `extra-deps` (here: o-clock-0.1.1)
35−we wanted to overlay over the stackage snapshot, and what local
35+we wanted to add over the stackage snapshot, and what local
36packages we want (here: my-package).
36packages we want (here: my-package).
37
37
38*If you came here from the [User Guide](/user-guide), go back and
38*If you came here from the [User Guide](/user-guide), go back and
docs/user-guide.md+3−3
@@ -86,12 +86,12 @@ let
86 # Cabal projects use mkPkgSet
86 # Cabal projects use mkPkgSet
87 pkgSet = haskell.mkPkgSet {
87 pkgSet = haskell.mkPkgSet {
88 pkg-def = my-pkgs.pkg-def;
88 pkg-def = my-pkgs.pkg-def;
89− pkg-def-overlays = [
89+ pkg-def-extras = [
90− # this overlay will provide additional packages
90+ # these extras will provide additional packages
91 # ontop of the package set. E.g. extra-deps
91 # ontop of the package set. E.g. extra-deps
92 # for stack packages. or local packages for
92 # for stack packages. or local packages for
93 # cabal.projects
93 # cabal.projects
94− my-pkgs.overlay
94+ my-pkgs.extras
95 ];
95 ];
96 modules = [
96 modules = [
97 # specific package overrides would go here
97 # specific package overrides would go here
package-set.nix+7−7
@@ -1,5 +1,5 @@
1−let f = { hackage, pkgs, pkg-def, pkg-def-overlays ? [], modules ? [] }: let
1+let f = { hackage, pkgs, pkg-def, pkg-def-extras ? [], modules ? [] }: let
2− buildModules = f { inherit hackage pkg-def pkg-def-overlays modules; pkgs = pkgs.buildPackages; };
2+ buildModules = f { inherit hackage pkg-def pkg-def-extras modules; pkgs = pkgs.buildPackages; };
3in pkgs.lib.evalModules {
3in pkgs.lib.evalModules {
4 modules = modules ++ [
4 modules = modules ++ [
5 ({ lib, ... }: {
5 ({ lib, ... }: {
@@ -33,7 +33,7 @@ in pkgs.lib.evalModules {
33 # or
33 # or
34 # { y = ./foo.nix; }
34 # { y = ./foo.nix; }
35 # As such the desugarer desugars this short hand syntax.
35 # As such the desugarer desugars this short hand syntax.
36− let desugar = overlay:
36+ let desugar = extras:
37 let
37 let
38 isPath = x: builtins.typeOf x == "path";
38 isPath = x: builtins.typeOf x == "path";
39 # rewrite
39 # rewrite
@@ -51,19 +51,19 @@ in pkgs.lib.evalModules {
51 # into
51 # into
52 # x.revision = import ./some/path;
52 # x.revision = import ./some/path;
53 expand-paths = pkg: if !(isPath pkg.revision) then pkg else { revision = import pkg.revision; };
53 expand-paths = pkg: if !(isPath pkg.revision) then pkg else { revision = import pkg.revision; };
54− # apply injection and expansion to the "packages" in overlay.
54+ # apply injection and expansion to the "packages" in extras.
55 in lib.mapAttrs (k: v: if k != "packages"
55 in lib.mapAttrs (k: v: if k != "packages"
56 then v
56 then v
57 else lib.mapAttrs (_: pkg: (expand-paths (inject-revision pkg))) v)
57 else lib.mapAttrs (_: pkg: (expand-paths (inject-revision pkg))) v)
58− (inject-packages overlay);
58+ (inject-packages extras);
59− # fold any potential `pkg-def-overlays`
59+ # fold any potential `pkg-def-extras`
60 # onto the `pkg-def`.
60 # onto the `pkg-def`.
61 #
61 #
62 # This means you can have a base definition (e.g. stackage)
62 # This means you can have a base definition (e.g. stackage)
63 # and augment it with custom packages to your liking.
63 # and augment it with custom packages to your liking.
64 in foldl' lib.recursiveUpdate
64 in foldl' lib.recursiveUpdate
65 (pkg-def hackage)
65 (pkg-def hackage)
66− (map (p: desugar (if builtins.isFunction p then p hackage else p)) pkg-def-overlays)
66+ (map (p: desugar (if builtins.isFunction p then p hackage else p)) pkg-def-extras)
67 ;
67 ;
68
68
69 })
69 })
test/builder-haddock/default.nix+1−1
@@ -9,7 +9,7 @@ let
9 # plan-to-nix dist-newstyle/cache/plan.json > plan.nix
9 # plan-to-nix dist-newstyle/cache/plan.json > plan.nix
10 # cabal-to-nix test-haddock.cabal > test-haddock.nix
10 # cabal-to-nix test-haddock.cabal > test-haddock.nix
11 pkg-def = import ./plan.nix;
11 pkg-def = import ./plan.nix;
12− pkg-def-overlays = [
12+ pkg-def-extras = [
13 { test-haddock = ./test-haddock.nix; }
13 { test-haddock = ./test-haddock.nix; }
14 ];
14 ];
15 modules = [
15 modules = [
test/cabal-22/default.nix+1−1
@@ -5,7 +5,7 @@ with stdenv.lib;
5let
5let
6 pkgSet = mkPkgSet {
6 pkgSet = mkPkgSet {
7 pkg-def = import ./plan.nix;
7 pkg-def = import ./plan.nix;
8− pkg-def-overlays = [
8+ pkg-def-extras = [
9 { project = ./project.nix; }
9 { project = ./project.nix; }
10 ];
10 ];
11 modules = [ ];
11 modules = [ ];
test/cabal-simple/default.nix+1−1
@@ -10,7 +10,7 @@ let
10 # 3. plan-to-nix ./dist-newstyle/cache/plan.json > plan.nix
10 # 3. plan-to-nix ./dist-newstyle/cache/plan.json > plan.nix
11 pkgSet = mkPkgSet {
11 pkgSet = mkPkgSet {
12 pkg-def = import ./plan.nix;
12 pkg-def = import ./plan.nix;
13− pkg-def-overlays = [
13+ pkg-def-extras = [
14 { cabal-simple = ./cabal-simple.nix;
14 { cabal-simple = ./cabal-simple.nix;
15 }
15 }
16 ];
16 ];
test/cabal-sublib/default.nix+1−1
@@ -10,7 +10,7 @@ let
10 # 3. plan-to-nix ./dist-newstyle/cache/plan.json > plan.nix
10 # 3. plan-to-nix ./dist-newstyle/cache/plan.json > plan.nix
11 pkgSet = mkPkgSet {
11 pkgSet = mkPkgSet {
12 pkg-def = import ./plan.nix;
12 pkg-def = import ./plan.nix;
13− pkg-def-overlays = [
13+ pkg-def-extras = [
14 { cabal-sublib = ./cabal-sublib.nix;
14 { cabal-sublib = ./cabal-sublib.nix;
15 }
15 }
16 ];
16 ];
test/stack-simple/default.nix+1−1
@@ -7,7 +7,7 @@ let
7 # generated by running hpack then stack-to-nix.
7 # generated by running hpack then stack-to-nix.
8 pkgSet = mkStackPkgSet {
8 pkgSet = mkStackPkgSet {
9 stack-pkgs = import ./stack-pkgs.nix;
9 stack-pkgs = import ./stack-pkgs.nix;
10− pkg-def-overlays = [];
10+ pkg-def-extras = [];
11 modules = [];
11 modules = [];
12 };
12 };
13
13
test/stack-simple/stack-pkgs.nix+2−2
@@ -1,5 +1,5 @@
1{
1{
2− overlay = hackage:
2+ extras = hackage:
3 { packages = {} // { stack-simple = ./.stack.nix/stack-simple.nix; }; };
3 { packages = {} // { stack-simple = ./.stack.nix/stack-simple.nix; }; };
4 resolver = "lts-13.6";
4 resolver = "lts-13.6";
5− }
5+}
test/with-packages/default.nix+1−1
@@ -10,7 +10,7 @@ let
10 # plan-to-nix dist-newstyle/cache/plan.json > plan.nix
10 # plan-to-nix dist-newstyle/cache/plan.json > plan.nix
11 # cabal-to-nix test-with-packages.cabal > test-with-packages.nix
11 # cabal-to-nix test-with-packages.cabal > test-with-packages.nix
12 pkg-def = import ./plan.nix;
12 pkg-def = import ./plan.nix;
13− pkg-def-overlays = [
13+ pkg-def-extras = [
14 { test-with-packages = ./test-with-packages.nix; }
14 { test-with-packages = ./test-with-packages.nix; }
15 ];
15 ];
16 modules = [
16 modules = [