at 18.09-beta 60 lines 1.5 kB view raw
1{ stdenv, fetchurl 2 3# Build runit-init as a static binary 4, static ? false 5}: 6 7stdenv.mkDerivation rec { 8 name = "runit-${version}"; 9 version = "2.1.2"; 10 11 src = fetchurl { 12 url = "http://smarden.org/runit/${name}.tar.gz"; 13 sha256 = "065s8w62r6chjjs6m9hapcagy33m75nlnxb69vg0f4ngn061dl3g"; 14 }; 15 16 patches = [ 17 ./fix-ar-ranlib.patch 18 ]; 19 20 outputs = [ "out" "man" ]; 21 22 sourceRoot = "admin/${name}"; 23 24 doCheck = true; 25 26 buildInputs = stdenv.lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ]; 27 28 postPatch = '' 29 sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h 30 # usernamespace sandbox of nix seems to conflict with runit's assumptions 31 # about unix users. Therefor skip the check 32 sed -i '/.\/chkshsgr/d' src/Makefile 33 '' + stdenv.lib.optionalString (!static) '' 34 sed -i 's,-static,,g' src/Makefile 35 ''; 36 37 preBuild = '' 38 cd src 39 40 # Both of these are originally hard-coded to gcc 41 echo ${stdenv.cc.targetPrefix}cc > conf-cc 42 echo ${stdenv.cc.targetPrefix}cc > conf-ld 43 ''; 44 45 installPhase = '' 46 mkdir -p $out/bin 47 cp -t $out/bin $(< ../package/commands) 48 49 mkdir -p $man/share/man 50 cp -r ../man $man/share/man/man8 51 ''; 52 53 meta = with stdenv.lib; { 54 description = "UNIX init scheme with service supervision"; 55 license = licenses.bsd3; 56 homepage = http://smarden.org/runit; 57 maintainers = with maintainers; [ rickynils joachifm ]; 58 platforms = platforms.linux; 59 }; 60}