git.iko.soy/typeable/nixpkgs-stackage
on master help sign in
Rename haskell-overlay.nix
commit954de18e14599c80c00fb128c7c824bc47e257f1 authorDmitry Bushev <bushevdv@gmail.com> dateWed 10 Jan 2018, 15:43 (9 years ago) parentc94ae34
5 files changed+84−83
README.md+2−2 default.nix+61−5 haskell-overlay.nix−63 nixpkgs.nix+5 release.nix+16−13
README.md+2−2
@@ -9,11 +9,11 @@ Nixpgs overlay
99
1010## Install
1111
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.
1313
1414```
1515cd ~/.config/nixpkgs/overlays
16−ln -s /path/to/haskell-overlay.nix stackage-overlay.nix
16+ln -s /path/to/default.nix stackage-overlay.nix
1717```
1818
1919## Haskell overlay
default.nix+61−5
@@ -1,7 +1,63 @@
1−# Nixpkgs overlay which aggregates overlays for tools and products
1+self: super:
22
3−{ nixpkgs ? import <nixpkgs> {} }:
3+let
44
5−with nixpkgs.lib;
6−let haskellOverlay = import ./haskell-overlay.nix;
7−in fix (extends haskellOverlay (_: nixpkgs))
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+}
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 @@
44
55let
66 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]
714 supportedStackageReleases =
815 if supportedReleases == null
916 then
@@ -13,31 +20,27 @@ let
1320 (builtins.readFile ./supported-stackage-releases.txt)))
1421 else
1522 supportedReleases;
16− release = import <nixpkgs/pkgs/top-level/release-lib.nix> {
17− inherit supportedSystems;
18− nixpkgsArgs = { overlays = [ (import ./haskell-overlay.nix) ]; };
19− };
2023
2124 # hasSupportedSystem :: System -> Derivation -> Bool
2225 hasSupportedSystem = system: pkg:
2326 # Test `isAttrs pkg` to ensure that pkg is a derivation
2427 lib.isAttrs pkg && lib.elem system pkg.meta.platforms;
2528
26− # genJobSetFiltered :: StackageRelease -> System -> AttrSet
27− genJobSetFiltered = lts: system:
29+ # genJobSetFiltered :: System -> StackageVersion -> AttrSet
30+ genJobSetFiltered = system: stackage:
2831 lib.filterAttrs
2932 (_: pkg: hasSupportedSystem system pkg)
30− (release.pkgsFor system).haskell.packages.stackage."${lts}";
33+ (release.pkgsFor system).haskell.packages.stackage."${stackage}";
3134
32− # genJobSetFull :: StackageRelease -> System -> AttrSet
33− genJobSetFull = lts: system:
34− (release.pkgsFor system).haskell.packages.stackage."${lts}";
35+ # genJobSetFull :: System -> StackageVersion -> AttrSet
36+ genJobSetFull = system: stackage:
37+ (release.pkgsFor system).haskell.packages.stackage."${stackage}";
3538
3639 # genJobSet :: StackageRelease -> System -> AttrSet
3740 genJobSet = if inHydra then genJobSetFull else genJobSetFiltered;
3841
3942in
40− lib.genAttrs supportedStackageReleases (stackage:
41− lib.genAttrs supportedSystems (system:
42− genJobSet stackage system
43+ lib.genAttrs supportedSystems (system:
44+ lib.genAttrs supportedStackageReleases (stackage:
45+ genJobSet system stackage
4346 ))