-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdefault.nix
54 lines (54 loc) · 2.09 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ mkEnv ? null
, target ? "GPipe-GLFW"
, config ? { allowBroken = true; }
, ...
}:
let
nixpkgs = import
(builtins.fetchTarball {
# latest https://github.com/NixOS/nixpkgs/commits/nixos-20.09 as of Sun 01 Nov 2020 10:25:16 PM UTC
url = "https://github.com/NixOS/nixpkgs/archive/edb26126d98bc696f4f3e206583faa65d3d6e818.tar.gz";
sha256 = "1cl4ka4kk7kh3bl78g06dhiidazf65q8miyzaxi9930d6gwyzkci";
})
{ inherit config; };
# package set for haskell compiler version
haskellCompilerPackages = nixpkgs.haskellPackages; # don't care about compiler version
# override package set to inject project components
haskellPackages = haskellCompilerPackages.override
(old: {
all-cabal-hashes = nixpkgs.fetchurl {
# latest https://github.com/commercialhaskell/all-cabal-hashes/commits/hackage as of Sun 01 Nov 2020 10:26:50 PM UTC
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/ce6d987d56e5a3f2af4a41a417405e43db36e337.tar.gz";
sha256 = "17i6hz4063xhxqzdddp38clhm9sccsd9y4wykz65hikhaxhpnwlh";
};
overrides = self: super: with nixpkgs.haskell.lib; rec {
# declare each of the packages in this project
GPipe = overrideCabal (self.callHackage "GPipe" "2.2.5" { }) {
jailbreak = true; # relies on an old version of linear
};
GPipe-GLFW = overrideCabal (self.callCabal2nix "GPipe-GLFW" (nixpkgs.nix-gitignore.gitignoreSource [ ] ./GPipe-GLFW) { }) {
passthru = {
inherit nixpkgs;
inherit haskellPackages;
inherit projectPackages;
};
};
Smoketests = self.callCabal2nix "Smoketests" (nixpkgs.nix-gitignore.gitignoreSource [ ] ./Smoketests) { };
};
});
# packages part of this local project
projectPackages = with haskellPackages; [
GPipe
GPipe-GLFW
Smoketests
];
# derivation to build
drv = haskellPackages."${target}";
in
if
(mkEnv != null && mkEnv) || (mkEnv == null && nixpkgs.lib.inNixShell)
then
drv.env.overrideAttrs
(old: { nativeBuildInputs = old.nativeBuildInputs ++ [ nixpkgs.ghcid ]; })
else
drv