git.iko.soy/typeable/nixpkgs-stackage
on master help sign in
Rename haskell-overlay.nix
954de18Dmitry Bushev
README.md+2−2
@@ -9,11 +9,11 @@ Nixpgs overlay
9
9
10## Install
10## Install
11
11
12−Symlink the current `./haskell-overlay.nix` into the `~/.config/nixpkgs/overlays` folder.
12+Symlink the current `./default.nix` into the `~/.config/nixpkgs/overlays` folder.
13
13
14```
14```
15cd ~/.config/nixpkgs/overlays
15cd ~/.config/nixpkgs/overlays
16−ln -s /path/to/haskell-overlay.nix stackage-overlay.nix
16+ln -s /path/to/default.nix stackage-overlay.nix
17```
17```
18
18
19## Haskell overlay
19## Haskell overlay
default.nix+61−5
@@ -1,7 +1,63 @@
1−# Nixpkgs overlay which aggregates overlays for tools and products
1+self: super:
2
2
3−{ nixpkgs ? import <nixpkgs> {} }:
3+let
4
4
5−with nixpkgs.lib;
5+ # from pkgs/stdenv/generic/make-derivation.nix
6−let haskellOverlay = import ./haskell-overlay.nix;
6+ # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
7−in fix (extends haskellOverlay (_: nixpkgs))
7+ normalizedConfigureFlags = configureFlags: let inherit (super) lib; in
8+ (/**/ if lib.isString configureFlags then [configureFlags]
9+ else if configureFlags == null then []
10+ else configureFlags);
11+
12+in {
13+ haskell = super.haskell // {
14+ packages = super.haskell.packages // {
15+ stackage = super.callPackage ./stackage {};
16+ };
17+ };
18+
19+ stackage2nix = super.callPackage ./stackage2nix {
20+ stackage2nix = super.haskell.lib.disableSharedExecutables
21+ (self.haskell.packages.stackage.lts-100.callPackage ./stackage2nix/stackage2nix.nix{});
22+ cacheVersion = builtins.readFile ./cache-version.txt;
23+ };
24+
25+ stackage2nix-static = super.callPackage ./stackage2nix {
26+ stackage2nix =
27+ let
28+ staticConfigureFlags = super.lib.concatStringsSep " " [
29+ "--ghc-option=-optl=-static"
30+ "--ghc-option=-optl=-pthread"
31+ "--ghc-option=-optl=-L${super.glibc.static}/lib"
32+ "--ghc-option=-optl=-L${super.gmp5.static}/lib"
33+ "--ghc-option=-optl=-L${self.icu-static.static}/lib"
34+ "--ghc-option=-optl=-L${self.openssl-static.static}/lib"
35+ "--ghc-option=-optl=-L${super.zlib.static}/lib"
36+ ];
37+ buildStaticExecutable = drv:
38+ super.haskell.lib.appendConfigureFlag (super.haskell.lib.disableSharedExecutables drv) staticConfigureFlags;
39+ in
40+ buildStaticExecutable
41+ (self.haskell.packages.stackage.lts-100.callPackage ./stackage2nix/stackage2nix.nix{});
42+ cacheVersion = builtins.readFile ./cache-version.txt;
43+ };
44+
45+ icu-static = super.icu.overrideAttrs (attrs: {
46+ dontDisableStatic = true;
47+ configureFlags = normalizedConfigureFlags attrs.configureFlags ++ [ "--enable-static" ];
48+ outputs = attrs.outputs ++ [ "static" ];
49+ postInstall = ''
50+ moveToOutput "lib/*.a" "$static"
51+ '' + attrs.postInstall;
52+ });
53+
54+ openssl-static = super.openssl.overrideAttrs (attrs: {
55+ dontDisableStatic = true;
56+ outputs = attrs.outputs ++ [ "static" ];
57+ postInstall = ''
58+ mkdir -p $static/lib;
59+ moveToOutput "*.a" "$static/lib";
60+ '' + attrs.postInstall;
61+ });
62+
63+}
haskell-overlay.nixdeleted−63
@@ -1,63 +0,0 @@
1−self: super:
2−
3−let
4−
5− # from pkgs/stdenv/generic/make-derivation.nix
6− # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
7− normalizedConfigureFlags = configureFlags: let inherit (super) lib; in
8− (/**/ if lib.isString configureFlags then [configureFlags]
9− else if configureFlags == null then []
10− else configureFlags);
11−
12−in {
13− haskell = super.haskell // {
14− packages = super.haskell.packages // {
15− stackage = super.callPackage ./stackage {};
16− };
17− };
18−
19− stackage2nix = super.callPackage ./stackage2nix {
20− stackage2nix = super.haskell.lib.disableSharedExecutables
21− (self.haskell.packages.stackage.lts-100.callPackage ./stackage2nix/stackage2nix.nix{});
22− cacheVersion = builtins.readFile ./cache-version.txt;
23− };
24−
25− stackage2nix-static = super.callPackage ./stackage2nix {
26− stackage2nix =
27− let
28− staticConfigureFlags = super.lib.concatStringsSep " " [
29− "--ghc-option=-optl=-static"
30− "--ghc-option=-optl=-pthread"
31− "--ghc-option=-optl=-L${super.glibc.static}/lib"
32− "--ghc-option=-optl=-L${super.gmp5.static}/lib"
33− "--ghc-option=-optl=-L${self.icu-static.static}/lib"
34− "--ghc-option=-optl=-L${self.openssl-static.static}/lib"
35− "--ghc-option=-optl=-L${super.zlib.static}/lib"
36− ];
37− buildStaticExecutable = drv:
38− super.haskell.lib.appendConfigureFlag (super.haskell.lib.disableSharedExecutables drv) staticConfigureFlags;
39− in
40− buildStaticExecutable
41− (self.haskell.packages.stackage.lts-100.callPackage ./stackage2nix/stackage2nix.nix{});
42− cacheVersion = builtins.readFile ./cache-version.txt;
43− };
44−
45− icu-static = super.icu.overrideAttrs (attrs: {
46− dontDisableStatic = true;
47− configureFlags = normalizedConfigureFlags attrs.configureFlags ++ [ "--enable-static" ];
48− outputs = attrs.outputs ++ [ "static" ];
49− postInstall = ''
50− moveToOutput "lib/*.a" "$static"
51− '' + attrs.postInstall;
52− });
53−
54− openssl-static = super.openssl.overrideAttrs (attrs: {
55− dontDisableStatic = true;
56− outputs = attrs.outputs ++ [ "static" ];
57− postInstall = ''
58− mkdir -p $static/lib;
59− moveToOutput "*.a" "$static/lib";
60− '' + attrs.postInstall;
61− });
62−
63−}
nixpkgs.nixnew file+5
@@ -0,0 +1,5 @@
1+# Nixpkgs with overlay
2+
3+{ nixpkgs ? import <nixpkgs> }:
4+
5+nixpkgs { overlays = [ (import ./default.nix) ]; }
release.nix+16−13
@@ -4,6 +4,13 @@
4
4
5let
5let
6 lib = (import <nixpkgs> {}).lib;
6 lib = (import <nixpkgs> {}).lib;
7+
8+ release = import <nixpkgs/pkgs/top-level/release-lib.nix> {
9+ inherit supportedSystems;
10+ nixpkgsArgs = { overlays = [ (import ./default.nix) ]; };
11+ };
12+
13+ # supportedStackageReleases :: [StackageVersion]
7 supportedStackageReleases =
14 supportedStackageReleases =
8 if supportedReleases == null
15 if supportedReleases == null
9 then
16 then
@@ -13,31 +20,27 @@ let
13 (builtins.readFile ./supported-stackage-releases.txt)))
20 (builtins.readFile ./supported-stackage-releases.txt)))
14 else
21 else
15 supportedReleases;
22 supportedReleases;
16− release = import <nixpkgs/pkgs/top-level/release-lib.nix> {
17− inherit supportedSystems;
18− nixpkgsArgs = { overlays = [ (import ./haskell-overlay.nix) ]; };
19− };
20
23
21 # hasSupportedSystem :: System -> Derivation -> Bool
24 # hasSupportedSystem :: System -> Derivation -> Bool
22 hasSupportedSystem = system: pkg:
25 hasSupportedSystem = system: pkg:
23 # Test `isAttrs pkg` to ensure that pkg is a derivation
26 # Test `isAttrs pkg` to ensure that pkg is a derivation
24 lib.isAttrs pkg && lib.elem system pkg.meta.platforms;
27 lib.isAttrs pkg && lib.elem system pkg.meta.platforms;
25
28
26− # genJobSetFiltered :: StackageRelease -> System -> AttrSet
29+ # genJobSetFiltered :: System -> StackageVersion -> AttrSet
27− genJobSetFiltered = lts: system:
30+ genJobSetFiltered = system: stackage:
28 lib.filterAttrs
31 lib.filterAttrs
29 (_: pkg: hasSupportedSystem system pkg)
32 (_: pkg: hasSupportedSystem system pkg)
30− (release.pkgsFor system).haskell.packages.stackage."${lts}";
33+ (release.pkgsFor system).haskell.packages.stackage."${stackage}";
31
34
32− # genJobSetFull :: StackageRelease -> System -> AttrSet
35+ # genJobSetFull :: System -> StackageVersion -> AttrSet
33− genJobSetFull = lts: system:
36+ genJobSetFull = system: stackage:
34− (release.pkgsFor system).haskell.packages.stackage."${lts}";
37+ (release.pkgsFor system).haskell.packages.stackage."${stackage}";
35
38
36 # genJobSet :: StackageRelease -> System -> AttrSet
39 # genJobSet :: StackageRelease -> System -> AttrSet
37 genJobSet = if inHydra then genJobSetFull else genJobSetFiltered;
40 genJobSet = if inHydra then genJobSetFull else genJobSetFiltered;
38
41
39in
42in
43+ lib.genAttrs supportedSystems (system:
40− lib.genAttrs supportedStackageReleases (stackage:
44+ lib.genAttrs supportedStackageReleases (stackage:
41− lib.genAttrs supportedSystems (system:
42− genJobSet stackage system
45+ genJobSet system stackage
43 ))
46 ))