1 { lib, stdenv, fetchurl, darwin
3 # Build runit-init as a static binary
7 stdenv.mkDerivation rec {
12 url = "http://smarden.org/runit/${pname}-${version}.tar.gz";
13 sha256 = "sha256-le9NKGi5eMcXn+R5AeXFeOEc8nPSkr1iCL06fMsCkpA=";
20 outputs = [ "out" "man" ];
22 sourceRoot = "admin/${pname}-${version}";
26 buildInputs = lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
27 lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.libs.utmp;
30 sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h
31 # usernamespace sandbox of nix seems to conflict with runit's assumptions
32 # about unix users. Therefor skip the check
33 sed -i '/.\/chkshsgr/d' src/Makefile
34 '' + lib.optionalString (!static) ''
35 sed -i 's,-static,,g' src/Makefile
41 # Both of these are originally hard-coded to gcc
42 echo ${stdenv.cc.targetPrefix}cc > conf-cc
43 echo ${stdenv.cc.targetPrefix}cc ${lib.optionalString stdenv.hostPlatform.isDarwin "-Xlinker -x "}> conf-ld
48 cp -t $out/bin $(< ../package/commands)
50 mkdir -p $man/share/man
51 cp -r ../man $man/share/man/man8
55 description = "UNIX init scheme with service supervision";
56 license = licenses.bsd3;
57 homepage = "http://smarden.org/runit";
58 maintainers = with maintainers; [ joachifm ];
59 platforms = platforms.linux ++ platforms.darwin;