2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchurl, darwin
|
2017-04-18 01:04:10 +02:00
|
|
|
|
|
|
|
# Build runit-init as a static binary
|
2016-08-27 11:19:50 +02:00
|
|
|
, static ? false
|
|
|
|
}:
|
2014-10-15 13:08:05 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "runit";
|
2014-10-15 13:08:05 +02:00
|
|
|
version = "2.1.2";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "http://smarden.org/runit/${pname}-${version}.tar.gz";
|
2014-10-15 13:08:05 +02:00
|
|
|
sha256 = "065s8w62r6chjjs6m9hapcagy33m75nlnxb69vg0f4ngn061dl3g";
|
|
|
|
};
|
|
|
|
|
2017-10-29 19:00:31 +01:00
|
|
|
patches = [
|
|
|
|
./fix-ar-ranlib.patch
|
|
|
|
];
|
|
|
|
|
2016-07-27 13:32:13 +02:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2019-08-15 14:41:18 +02:00
|
|
|
sourceRoot = "admin/${pname}-${version}";
|
2016-07-27 13:32:13 +02:00
|
|
|
|
|
|
|
doCheck = true;
|
2014-10-15 13:08:05 +02:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
buildInputs = lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
|
|
|
|
lib.optional stdenv.isDarwin darwin.apple_sdk.libs.utmp;
|
2016-08-27 11:19:50 +02:00
|
|
|
|
2017-04-18 01:04:25 +02:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h
|
2017-07-01 19:59:03 +02: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
|
2021-01-15 10:19:50 +01:00
|
|
|
'' + lib.optionalString (!static) ''
|
2016-04-30 04:32:06 +02:00
|
|
|
sed -i 's,-static,,g' src/Makefile
|
|
|
|
'';
|
|
|
|
|
2016-07-27 13:32:13 +02:00
|
|
|
preBuild = ''
|
|
|
|
cd src
|
2016-08-27 11:44:07 +02:00
|
|
|
|
|
|
|
# Both of these are originally hard-coded to gcc
|
2017-10-29 19:00:31 +01:00
|
|
|
echo ${stdenv.cc.targetPrefix}cc > conf-cc
|
2021-01-15 10:19:50 +01:00
|
|
|
echo ${stdenv.cc.targetPrefix}cc ${lib.optionalString stdenv.isDarwin "-Xlinker -x "}> conf-ld
|
2014-10-15 13:08:05 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2016-07-27 13:32:13 +02:00
|
|
|
cp -t $out/bin $(< ../package/commands)
|
|
|
|
|
|
|
|
mkdir -p $man/share/man
|
|
|
|
cp -r ../man $man/share/man/man8
|
2014-10-15 13:08:05 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2014-10-15 13:08:05 +02:00
|
|
|
description = "UNIX init scheme with service supervision";
|
|
|
|
license = licenses.bsd3;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://smarden.org/runit";
|
2019-08-20 15:24:01 +02:00
|
|
|
maintainers = with maintainers; [ joachifm ];
|
2020-06-01 23:11:51 +02:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2014-10-15 13:08:05 +02:00
|
|
|
};
|
|
|
|
}
|