-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdefault.nix
47 lines (39 loc) · 1.04 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
{ lib
, stdenv
, coreutils
, musl
, glibc
, upx
, enableStatic ? false
, ...
}:
stdenv.mkDerivation {
pname = "pidproxy";
version = "0.0.1";
src = lib.cleanSource ./.;
nativeBuildInputs = lib.optional enableStatic upx;
buildInputs = [ (if enableStatic then musl else glibc) ];
checkInputs = [ coreutils ];
patchPhase = ''
patchShebangs ./test
'' + lib.optionalString (!enableStatic) ''
sed -i 's/-static //g' Makefile
'';
preBuild = lib.optionalString enableStatic ''
makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}cc -isystem ${musl.dev}/include -B${musl}/lib -L${musl}/lib")
'';
postBuild = lib.optionalString enableStatic ''
make pidproxy.upx
'';
installPhase = ''
mkdir -p $out/bin
cp ./pidproxy${lib.optionalString enableStatic ".upx"} $out/bin/pidproxy
'';
doCheck = true;
meta = with lib; {
homepage = "https://github.com/ZentriaMC/pidproxy";
description = "Lightweight signal forwarder for daemonizing programs";
license = licenses.gpl3;
platforms = platforms.linux;
};
}