-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
141 lines (136 loc) · 5.44 KB
/
flake.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
description = "hs-backend-booster";
inputs = {
haskell-backend.url = "github:runtimeverification/haskell-backend/531f7c1db1a9fad6d18cbcedb3cfd3e35d6b82a5";
stacklock2nix.follows = "haskell-backend/stacklock2nix";
nixpkgs.follows = "haskell-backend/nixpkgs";
};
outputs = { self, nixpkgs, stacklock2nix, haskell-backend }:
let
perSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
nixpkgsCleanFor = system: import nixpkgs { inherit system; };
nixpkgsFor = system:
import nixpkgs {
inherit system;
overlays =
[ stacklock2nix.overlay self.overlay haskell-backend.overlays.z3 ];
};
withZ3 = pkgs: pkg: exe:
pkgs.stdenv.mkDerivation {
name = exe;
phases = [ "installPhase" ];
buildInputs = with pkgs; [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} --prefix PATH : ${pkgs.z3}/bin
'';
};
ghcVersion = pkgs: pkgs.haskell.packages.ghc964;
in {
overlay = final: prev: {
booster-backend = final.stacklock2nix {
stackYaml = ./stack.yaml;
# This should based on the compiler version from the resolver in stack.yaml.
baseHaskellPkgSet = ghcVersion final;
cabal2nixArgsOverrides = args:
args // {
# The Haskell package `"graphviz"` depends on the _system_
# package `graphviz`, and takes the system package `graphviz` as one of its build
# inputs, but it is actually getting passed _itself_ (not the system package
# `graphviz`), which causes the infinite recursion.
"graphviz" = _: { graphviz = final.graphviz; };
};
additionalHaskellPkgSetOverrides = hfinal: hprev:
with final.haskell.lib; {
crypton-x509 = dontCheck hprev.crypton-x509;
decision-diagrams = dontCheck hprev.decision-diagrams;
fgl = dontCheck hprev.fgl;
graphviz = dontCheck hprev.graphviz;
smtlib-backends-process = dontCheck hprev.smtlib-backends-process;
hs-backend-booster = overrideCabal hprev.hs-backend-booster
(drv: {
doCheck = false;
postPatch = ''
${drv.postPatch or ""}
substituteInPlace library/Booster/VersionInfo.hs \
--replace '$(GitRev.gitHash)' '"${self.rev or "dirty"}"'
'';
});
json-rpc = dontCheck hprev.json-rpc;
kore = (dontCheck hprev.kore).override {
# bit pathological, but ghc-compact is already included with the ghc compiler
# and depending on another copy of ghc-compact breaks HLS in the dev shell.
ghc-compact = null;
};
lifted-base = dontCheck hprev.lifted-base;
prettyprinter = dontCheck hprev.prettyprinter;
tar = dontCheck hprev.tar;
};
# Additional packages that should be available for development.
additionalDevShellNativeBuildInputs = stacklockHaskellPkgSet:
with ghcVersion final; [
cabal-install
fourmolu
hlint
# provides haskell-language-server-wrapper
final.haskell-language-server
# provides the actual haskell-language-server binary
haskell-backend.packages.${prev.system}.haskell-language-server
final.z3
final.hpack
];
all-cabal-hashes = final.fetchurl {
url =
"https://github.com/commercialhaskell/all-cabal-hashes/archive/80fe3174b98134e50d4541c9c2a3803601f6fbb7.tar.gz";
sha256 = "sha256-b3E6JLu1tBpZnPXBJxNXfjkglY/du8k1l+WTS8Fetr4=";
};
};
};
packages = perSystem (system:
let
pkgs = nixpkgsFor system;
hs-backend-booster = with pkgs;
haskell.lib.justStaticExecutables
booster-backend.pkgSet.hs-backend-booster;
in {
kore-rpc-booster = withZ3 pkgs hs-backend-booster "kore-rpc-booster";
kore-rpc-client = withZ3 pkgs hs-backend-booster "kore-rpc-client";
});
devShells = perSystem (system: {
# Separate fourmolu+hlint and cabal shells just for CI
style = with nixpkgsCleanFor system;
mkShell {
nativeBuildInputs = [
(haskell.lib.justStaticExecutables
(ghcVersion pkgs).fourmolu)
(haskell.lib.justStaticExecutables
(ghcVersion pkgs).hlint)
pkgs.hpack
];
shellHook = ''
hpack && hpack dev-tools
'';
};
cabal = let pkgs = nixpkgsFor system;
in pkgs.booster-backend.pkgSet.shellFor {
packages = pkgs.booster-backend.localPkgsSelector;
nativeBuildInputs = [
pkgs.diffutils
(ghcVersion pkgs).cabal-install
pkgs.hpack
pkgs.jq
pkgs.nix
pkgs.z3
pkgs.lsof
];
};
});
devShell = perSystem (system:
(nixpkgsFor system).booster-backend.devShell.overrideAttrs (old: {
shellHook = ''
${old.shellHook}
hpack && hpack dev-tools
'';
}));
};
}