forked from containers/conmon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
78 lines (76 loc) · 2.19 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{ system ? builtins.currentSystem }:
let
pkgs = (import ./nixpkgs.nix {
overlays = [(final: pkg: {
pcre = (static pkg.pcre).overrideAttrs(x: {
configureFlags = x.configureFlags ++ [
"--enable-static"
];
});
})];
config = {
packageOverrides = pkg: {
autogen = (static pkg.autogen);
e2fsprogs = (static pkg.e2fsprogs);
libuv = (static pkg.libuv);
libseccomp = (static pkg.libseccomp);
glib = (static pkg.glib).overrideAttrs(x: {
outputs = [ "bin" "out" "dev" ];
mesonFlags = [
"-Ddefault_library=static"
"-Ddevbindir=${placeholder ''dev''}/bin"
"-Dgtk_doc=false"
"-Dnls=disabled"
];
});
gnutls = (static pkg.gnutls).overrideAttrs(x: {
configureFlags = (x.configureFlags or []) ++ [
"--disable-non-suiteb-curves"
"--disable-openssl-compatibility"
"--disable-rpath"
"--enable-local-libopts"
"--without-p11-kit"
];
});
systemd = (static pkg.systemd).overrideAttrs(x: {
outputs = [ "out" "dev" ];
mesonFlags = x.mesonFlags ++ [
"-Dstatic-libsystemd=true"
];
});
};
};
});
static = pkg: pkg.overrideAttrs(x: {
doCheck = false;
configureFlags = (x.configureFlags or []) ++ [
"--without-shared"
"--disable-shared"
];
dontDisableStatic = true;
enableSharedExecutables = false;
enableStatic = true;
});
self = with pkgs; stdenv.mkDerivation rec {
name = "conmon";
src = ./..;
vendorSha256 = null;
doCheck = false;
enableParallelBuilding = true;
outputs = [ "out" ];
nativeBuildInputs = [ bash gitMinimal pcre pkg-config which ];
buildInputs = [ glibc glibc.static glib libseccomp ];
prePatch = ''
export CFLAGS='-static -pthread'
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
'';
buildPhase = ''
patchShebangs .
make
'';
installPhase = ''
install -Dm755 bin/conmon $out/bin/conmon
'';
};
in self