on 2241afa help sign in
164 lines 6.8 kB history raw
1let
2 nixpkgsPath_21_11 =
3 "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.11.tar.gz";
4 nixpkgsDefault = import (builtins.fetchTarball nixpkgsPath_21_11) { };
5in
6{
7 nixpkgs ? nixpkgsDefault
8, compiler ? "default"
9}:
10let haskellPackages =
11 if compiler == "default"
12 then nixpkgs.haskellPackages
13 else nixpkgs.haskell.packages.${compiler};
15 mkPackage = super: pkg: path: opts: inShell:
16 let orig = super.callCabal2nixWithOptions pkg path opts {};
17 in if inShell
18 # Avoid copying the source directory to nix store by using
19 # src = null.
20 then orig.overrideAttrs (oldAttrs: { src = null; })
21 else orig;
23 mkPkgGit = super: gitSrc: rev: name:
24 let
25 src = builtins.fetchGit {
26 url = gitSrc;
27 rev = rev;
28 };
29 in super.callCabal2nix name src { };
31 mkPkgGitRef = super: gitSrc: rev: ref: name:
32 let
33 src = builtins.fetchGit {
34 url = gitSrc;
35 rev = rev;
36 ref = ref;
37 };
38 in super.callCabal2nix name src { };
40 mkHaskellPackages = inShell:
41 haskellPackages.override {
42 overrides = self: super:
43 with nixpkgs.haskell.lib;
44 {
45 test-runner = mkPackage super "test-runner" ./. "" inShell;
46 streamly-targets = mkPackage super "streamly-targets" ../../targets "" false;
48 bench-report =
49 nixpkgs.haskell.lib.overrideCabal
50 (let src = fetchGit {
51 url = "git@github.com:composewell/bench-report.git";
52 rev = "3e016780cd125f6c074b70f4ffed2329e2c4ab68";
53 }; in super.callCabal2nix "bench-report" src {})
54 (old:
55 { enableLibraryProfiling = false;
56 doHaddock = false;
57 });
59 bench-show = super.callHackageDirect {
60 pkg = "bench-show";
61 ver = "0.3.2";
62 sha256 = "16b8vyzdp9b5bh34kqmbfwjsyv8wgnxxwl8kjcpgxjsh52xzyaa0";
63 } { };
65# streamly-coreutils = let
66# src = "git@github.com:composewell/streamly-coreutils.git";
67# rev = "a12756efe24bbf303f2f6d66a95426c7657d297b";
68# in mkPkgGit super src rev "streamly-coreutils";
70 streamly-coreutils =
71 nixpkgs.haskell.lib.overrideCabal
72 (let src = fetchGit {
73 url = "git@github.com:composewell/streamly-coreutils.git";
74 rev = "b1e6fc37f0e898c54378129750d3ccc1c034f611";
75 }; in super.callCabal2nix "streamly-coreutils" src {})
76 (old:
77 { librarySystemDepends =
78 if builtins.currentSystem == "x86_64-darwin"
79 then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa]
80 else [];
81 #enableLibraryProfiling = false;
82 doHaddock = false;
83 doCheck = false;
84 });
86 streamly-shell = let
87 src = "https://github.com/composewell/streamly-shell.git";
88 rev = "1b3fea3239ebe47963955d81565b9d5e34567ab7";
89 in mkPkgGit super src rev "streamly-shell";
91 streamly-process = let
92 src = "https://github.com/composewell/streamly-process.git";
93 rev = "e310c8a9c6e61515373a2f5f1fb82f6e15fe452b";
94 in nixpkgs.haskell.lib.dontCheck
95 (mkPkgGit super src rev "streamly-process");
97 #streamly-process = nixpkgs.haskell.lib.dontCheck
98 # (super.callHackageDirect {
99 # pkg = "streamly-process";
100 # ver = "0.1.0";
101 # sha256 = "01nxisqfmn29fbirdsx71sfjp2rdqwrf469qyjcql2d11i1bxn94";
102 # } { });
104 # streamly = super.callHackageDirect {
105 # pkg = "streamly";
106 # ver = "0.8.0";
107 # sha256 = "0vy2lkljizlhpbpbybmg9jcmj2g4s1aaqd2dzy5c0y0n4rgwxask";
108 # } { };
109 streamly =
110 nixpkgs.haskell.lib.overrideCabal
111 #(super.callHackageDirect
112 # { pkg = "streamly";
113 # ver = "0.8.2";
114 # sha256 = "sha256-CjFq9SCdbgLZa7NqOE4OtC8OaFg4vK8VmIDjGU5rGko=";
115 # } {})
116 (let src = fetchGit {
117 url = "git@github.com:composewell/streamly.git";
118 rev = "14ee0b70363cf925e9cc067bf1df4ecbd047ac38";
119 }; in super.callCabal2nix "streamly" src {})
120 (old:
121 { librarySystemDepends =
122 if builtins.currentSystem == "x86_64-darwin"
123 then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa]
124 else [];
125 #enableLibraryProfiling = false;
126 doHaddock = false;
127 });
129 streamly-core =
130 nixpkgs.haskell.lib.overrideCabal
131 (let src = fetchGit {
132 url = "git@github.com:composewell/streamly.git";
133 rev = "14ee0b70363cf925e9cc067bf1df4ecbd047ac38";
134 }; in super.callCabal2nix "streamly-core" "${src}/core" {})
135 (old:
136 { librarySystemDepends =
137 if builtins.currentSystem == "x86_64-darwin"
138 then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa]
139 else [];
140 #enableLibraryProfiling = false;
141 doHaddock = false;
142 });
144 };
145 };
147 drv = mkHaskellPackages true;
149 shell = drv.shellFor {
150 packages = p:
151 [ p.test-runner
152 ];
153 # Use a better prompt
154 shellHook = ''
155 export CABAL_DIR="$(pwd)/.cabal.nix"
156 if test -n "$PS_SHELL"
157 then
158 export PS1="$PS_SHELL\[$bldred\](nix)\[$txtrst\] "
159 fi
160 '';
161 };
162in if nixpkgs.lib.inNixShell
163 then shell
164 else (mkHaskellPackages false).test-runner