2016-08-27 10:19:50 +01:00
|
|
|
{ stdenv, fetchurl
|
2017-04-18 00:04:10 +01:00
|
|
|
|
|
|
|
# Build runit-init as a static binary
|
2016-08-27 10:19:50 +01:00
|
|
|
, static ? false
|
|
|
|
}:
|
2014-10-15 12:08:05 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "runit-${version}";
|
|
|
|
version = "2.1.2";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://smarden.org/runit/${name}.tar.gz";
|
|
|
|
sha256 = "065s8w62r6chjjs6m9hapcagy33m75nlnxb69vg0f4ngn061dl3g";
|
|
|
|
};
|
|
|
|
|
2016-07-27 12:32:13 +01:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
sourceRoot = "admin/${name}";
|
|
|
|
|
|
|
|
doCheck = true;
|
2014-10-15 12:08:05 +01:00
|
|
|
|
2016-08-27 10:19:50 +01:00
|
|
|
buildInputs = stdenv.lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ];
|
|
|
|
|
2017-04-18 00:04:25 +01:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h
|
2017-07-01 18:59:03 +01:00
|
|
|
# usernamespace sandbox of nix seems to conflict with runit's assumptions
|
|
|
|
# about unix users. Therefor skip the check
|
|
|
|
sed -i '/.\/chkshsgr/d' src/Makefile
|
2017-04-18 00:04:25 +01:00
|
|
|
'' + stdenv.lib.optionalString (!static) ''
|
2016-04-30 03:32:06 +01:00
|
|
|
sed -i 's,-static,,g' src/Makefile
|
|
|
|
'';
|
|
|
|
|
2016-07-27 12:32:13 +01:00
|
|
|
preBuild = ''
|
|
|
|
cd src
|
2016-08-27 10:44:07 +01:00
|
|
|
|
|
|
|
# Both of these are originally hard-coded to gcc
|
|
|
|
echo cc > conf-cc
|
|
|
|
echo cc > conf-ld
|
2014-10-15 12:08:05 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2016-07-27 12:32:13 +01:00
|
|
|
cp -t $out/bin $(< ../package/commands)
|
|
|
|
|
|
|
|
mkdir -p $man/share/man
|
|
|
|
cp -r ../man $man/share/man/man8
|
2014-10-15 12:08:05 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "UNIX init scheme with service supervision";
|
|
|
|
license = licenses.bsd3;
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = http://smarden.org/runit;
|
2016-07-27 12:32:13 +01:00
|
|
|
maintainers = with maintainers; [ rickynils joachifm ];
|
2018-03-25 14:03:05 +01:00
|
|
|
platforms = platforms.linux;
|
2014-10-15 12:08:05 +01:00
|
|
|
};
|
|
|
|
}
|