-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdefault.nix
More file actions
68 lines (61 loc) · 1.92 KB
/
default.nix
File metadata and controls
68 lines (61 loc) · 1.92 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Inspired by https://discourse.nixos.org/t/nix-haskell-development-2020/6170/16
let
pinnedPkgs = import (builtins.fetchTarball {
# Descriptive name to make the store path easier to identify
name = "nixos-20.09-2020-12-13";
# Current commit from https://github.com/NixOS/nixpkgs/tree/nixos-20.09
url = "https://github.com/nixos/nixpkgs/archive/65c9cc79f1d179713c227bf447fb0dac384cdcda.tar.gz";
# Hash obtained using `nix-prefetch-url --unpack <url>`
sha256 = "0whxlm098vas4ngq6hm3xa4mdd2yblxcl5x5ny216zajp08yp1wf";
}) {};
packageName = "consul-haskell";
in
{
pkgs ? pinnedPkgs,
# compiler:
# If given as the default `null` uses the default `pkgs.haskellPackages`;
# if given as a string (e.g. `ghc865`), uses
# `pkgs.haskell.packages.${compiler}`.
compiler ? null,
}:
let
explicitSource =
(import ./explicitSource.nix { lib = pkgs.lib; }).explicitSource;
src = explicitSource ./. {
name = "consul-haskell";
includeDirs = [
./src
./tests
];
includeFiles = [
./consul-haskell.cabal
./Setup.hs
./LICENSE
./README.md
];
pathComponentExcludes = [ "build" "gen" ];
};
originalHaskellpackages =
if compiler == null
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
# Create a Haskell package set with our package in it,
# and add the required native packages to its dependencies.
myHaskellPackages = originalHaskellpackages.override {
overrides = hself: hsuper: {
"${packageName}" =
pkgs.haskell.lib.overrideCabal
(hself.callCabal2nix "${packageName}" src {})
(drv: {
# The test suite starts a consul server; add it to PATH.
preCheck = ''
export PATH="${pkgs.consul}/bin:$PATH"
'';
});
};
};
exe = pkgs.haskell.lib.justStaticExecutables (myHaskellPackages."${packageName}");
in
{
inherit exe;
}