forked from siriobalmelli/memorywell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
73 lines (63 loc) · 1.46 KB
/
default.nix
File metadata and controls
73 lines (63 loc) · 1.46 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
69
70
71
72
73
{ # deps
system ? builtins.currentSystem,
nixpkgs ? import <nixpkgs> { inherit system; },
nonlibc ? nixpkgs.nonlibc or import <nonlibc> { inherit system;
inherit buildtype;
inherit compiler;
inherit dep_type;
inherit mesonFlags;
},
# options
buildtype ? "release",
compiler ? "clang",
dep_type ? "shared",
mesonFlags ? ""
}:
# note that "nonlibc" above should not be clobbered by this
with nixpkgs;
stdenv.mkDerivation rec {
name = "memorywell";
#env = buildEnv { name = name; paths = nativeBuildInputs; };
outputs = [ "out" ];
# build-only deps
nativeBuildInputs = [
(lowPrio gcc)
clang-tools
clang
cscope
meson
ninja
pandoc
pkgconfig
python3
valgrind
which
];
# runtime deps
buildInputs = [
nonlibc
];
# just work with the current directory (aka: Git repo), no fancy tarness
src = ./.;
# Override the setupHook in the meson nix derviation,
# so that meson doesn't automatically get invoked from there.
meson = pkgs.meson.overrideAttrs ( oldAttrs: rec {
setupHook = "";
});
# don't harden away position-dependent speedups for static builds
hardeningDisable = [ "pic" "pie" ];
# build
mFlags = mesonFlags
+ " --buildtype=${buildtype}"
+ " -Ddep_type=${dep_type}";
configurePhase = ''
echo "flags: $mFlags"
echo "prefix: $out"
CC=${compiler} meson --prefix=$out build $mFlags
cd build
'';
buildPhase = "ninja";
doCheck = true;
checkPhase = "ninja test";
installPhase = "ninja install";
}