nixpkgs/pkgs/tools/system/runit/default.nix

62 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, darwin
# Build runit-init as a static binary
, static ? false
}:
2014-10-15 12:08:05 +01:00
stdenv.mkDerivation rec {
pname = "runit";
2014-10-15 12:08:05 +01:00
version = "2.1.2";
src = fetchurl {
url = "http://smarden.org/runit/${pname}-${version}.tar.gz";
2014-10-15 12:08:05 +01:00
sha256 = "065s8w62r6chjjs6m9hapcagy33m75nlnxb69vg0f4ngn061dl3g";
};
2017-10-29 18:00:31 +00:00
patches = [
./fix-ar-ranlib.patch
];
2016-07-27 12:32:13 +01:00
outputs = [ "out" "man" ];
sourceRoot = "admin/${pname}-${version}";
2016-07-27 12:32:13 +01:00
doCheck = true;
2014-10-15 12:08:05 +01:00
2021-01-15 09:19:50 +00:00
buildInputs = lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
lib.optional stdenv.isDarwin darwin.apple_sdk.libs.utmp;
postPatch = ''
sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h
# 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 09:19:50 +00:00
'' + 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
# Both of these are originally hard-coded to gcc
2017-10-29 18:00:31 +00:00
echo ${stdenv.cc.targetPrefix}cc > conf-cc
2021-01-15 09:19:50 +00:00
echo ${stdenv.cc.targetPrefix}cc ${lib.optionalString stdenv.isDarwin "-Xlinker -x "}> 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 lib; {
2014-10-15 12:08:05 +01:00
description = "UNIX init scheme with service supervision";
license = licenses.bsd3;
homepage = "http://smarden.org/runit";
maintainers = with maintainers; [ joachifm ];
platforms = platforms.linux ++ platforms.darwin;
2014-10-15 12:08:05 +01:00
};
}