This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
62 lines (49 loc) · 1.71 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
55
56
57
58
59
60
61
62
let
sources = import ./nix/sources.nix;
nixpkgs = sources.nixpkgs;
pkgs = import nixpkgs {
inherit config;
overlays = [
(_: _: { inherit sources; })
];
};
ghcVersion = "ghc865";
# https://github.com/cachix/ghcide-nix/blob/master/nix/sources.json
# nixpkgsRev = "2d149fcaf3b794947eeb3899859a371d10d38f9f";
githubTarball = owner: repo: rev:
builtins.fetchTarball { url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; };
ghcide = import (githubTarball "cachix" "ghcide-nix" "master") {};
gitignore = pkgs.nix-gitignore.gitignoreSourcePure [ ./.gitignore ];
extra-deps = with pkgs.haskell.lib; (super: {
});
packages = {
servant-forma = ./servant-forma;
servant-forma-server = ./servant-forma-server;
};
config = {
allowBroken = true;
packageOverrides = pkgs: rec {
haskellPackages = pkgs.haskell.packages."${ghcVersion}".override {
overrides = self: super: (extra-deps super) // builtins.mapAttrs (name: path: super.callCabal2nix name (gitignore path) {}) packages;
};
};
};
shell = with pkgs; haskellPackages.shellFor {
packages = p: builtins.attrValues (builtins.mapAttrs (name: path: builtins.getAttr name haskellPackages) packages);
buildInputs = [
haskellPackages.cabal-install
haskellPackages.niv
ghcide."ghcide-${ghcVersion}"
(writeShellScriptBin "testLib" ''
${haskellPackages.cabal-install}/bin/cabal test --enable-library-profiling --test-show-details=direct $1 ''${@:2}
'')
(writeShellScriptBin "watchLib" ''
${ghcid}/bin/ghcid -c "cabal v2-repl $1" -W ''${@:2}
'')
];
};
in {
inherit nixpkgs;
inherit pkgs;
inherit shell;
}