-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
146 lines (121 loc) · 4.29 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
142
143
144
145
146
{
description = "Multipath tcp pcap analyzer tool";
nixConfig = {
extra-substituters = [
"https://haskell-language-server.cachix.org"
];
extra-trusted-public-keys = [
"haskell-language-server.cachix.org-1:juFfHrwkOxqIOZShtC4YC1uT1bBcq2RSvC7OMKx0Nz8="
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
replica.url = "github:ReplicaTest/REPLica";
flake-utils.url = "github:numtide/flake-utils";
hls.url = "github:haskell/haskell-language-server";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, poetry, replica, hls, ... }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
compilerVersion = "8107";
# compilerVersion = "901";
haskellOverlay = hnew: hold: with pkgs.haskell.lib; {
# TODO override Frames
ip = unmarkBroken (dontCheck hold.ip);
bytebuild = unmarkBroken (dontCheck hold.bytebuild);
relude = hold.relude_1_0_0_1;
# may not be needed anymore ?
wide-word = unmarkBroken (dontCheck hold.wide-word);
polysemy = hnew.polysemy_1_7_1_0;
co-log-polysemy = doJailbreak (hold.co-log-polysemy);
polysemy-plugin = hnew.polysemy-plugin_0_4_3_0;
netlink = (overrideSrc hold.netlink {
# src = builtins.fetchGit {
# # url = https://github.com/ongy/netlink-hs;
# url = https://github.com/teto/netlink-hs;
# };
version = "1.1.2.0";
src = pkgs.fetchFromGitHub {
owner = "teto";
repo = "netlink-hs";
rev = "090a48ebdbc35171529c7db1bd420d227c19b76d";
sha256 = "sha256-qopa1ED4Bqk185b1AXZ32BG2s80SHDSkCODyoZfnft0=";
};
});
# self-reference to build mptcpanalyzer/mptcp-pm
mptcp = self.packages."${system}".mptcp;
};
pkgs = import nixpkgs {
inherit system;
# overlays = pkgs.lib.attrValues (self.overlays);
config = { allowUnfree = false; allowBroken = true;};
};
hsPkgs = pkgs.haskell.packages."ghc${compilerVersion}";
# modifier used in haskellPackages.developPackage
myModifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hsPkgs; [
cabal-install
replica.packages.${system}.build
hls.packages.${system}."haskell-language-server-${compilerVersion}"
# not available
# hls.packages.${system}."hie-bios-${compilerVersion}"
cairo # for chart-cairo
dhall # for the repl
pkgs.dhall-json # for dhall-to-json
glib
hasktags
stan
# pkg-config
zlib
pkgs.dhall-lsp-server
pkgs.stylish-haskell
# we need the mptcp.h in mptcp-pm
# pkgs.linuxHeaders
# alternatively we could do makeLinuxHeaders pkgs.linux_latest.dev
# threadscope
]);
mkPackage = name:
hsPkgs.developPackage {
root = pkgs.lib.cleanSource (builtins.toPath ./. + "/${name}");
name = name;
returnShellEnv = false;
withHoogle = true;
overrides = haskellOverlay;
modifier = myModifier;
};
in {
packages = {
# basic library
mptcp = mkPackage "mptcp";
# path manager
mptcp-pm = mkPackage "mptcp-pm";
# pcap analysis
mptcpanalyzer = let
pkg = mkPackage "mptcpanalyzer";
in
pkg.overrideAttrs(oa: {
nativeBuildInputs = (oa.nativeBuildInputs or []) ++ [ pkgs.installShellFiles ];
});
};
defaultPackage = self.packages.${system}.mptcpanalyzer;
devShells = {
mptcp = self.packages.${system}.mptcp.envFunc {};
mptcp-pm = self.packages.${system}.mptcp-pm.envFunc {};
mptcpanalyzer = let
shell = self.packages.${system}.mptcpanalyzer.envFunc {};
in shell.overrideAttrs(oa: {
postShellHook = ''
cd mptcpanalyzer
set -x
result=$(cabal list-bin exe:mptcpanalyzer)
if [ $? -eq 0 ]; then
export PATH="$(dirname $result):$PATH"
fi
'';
});
};
});
}