-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault.nix
More file actions
88 lines (75 loc) · 1.97 KB
/
default.nix
File metadata and controls
88 lines (75 loc) · 1.97 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
# options
buildtype ? "release",
compiler ? "clang",
dep_type ? "shared",
mesonFlags ? "",
# deps
system ? builtins.currentSystem,
nixpkgs ? import (builtins.fetchGit {
url = "https://siriobalmelli@github.com/siriobalmelli-foss/nixpkgs.git";
ref = "refs/tags/sirio-2022-08-24";
}) { }
}:
with nixpkgs;
stdenv.mkDerivation rec {
name = "memorywell";
version = "0.2.1";
outputs = [ "out" ];
meta = with nixpkgs.lib; {
description = "nonblocking circular buffer";
homepage = https://siriobalmelli.github.io/memorywell/;
license = licenses.lgpl21Plus;
platforms = platforms.unix;
maintainers = [ "https://github.com/siriobalmelli" ];
};
nonlibc = nixpkgs.nonlibc or import (builtins.fetchGit {
url = "https://github.com/siriobalmelli/nonlibc.git";
ref = "master";
}) {};
inputs = [
nixpkgs.gcc
nixpkgs.clang
nixpkgs.meson
nixpkgs.ninja
nixpkgs.pandoc
nixpkgs.pkgconfig
];
buildInputs = if ! lib.inNixShell then inputs else inputs ++ [
nixpkgs.cscope
nixpkgs.gdb
nixpkgs.man
nixpkgs.valgrind
nixpkgs.which
];
propagatedBuildInputs = [
nonlibc
];
# just work with the current directory (aka: Git repo), no fancy tarness
src = nixpkgs.nix-gitignore.gitignoreSource [] ./.;
# Override the setupHook in the meson nix derivation,
# so that meson doesn't automatically get invoked from there.
meson = nixpkgs.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
'';
}