about summary refs log tree commit diff
path: root/pkgs/tools/system
diff options
context:
space:
mode:
authorAndrew Fontaine <andrew@afontaine.ca>2020-06-01 17:11:51 -0400
committerAndrew Fontaine <andrew@afontaine.ca>2020-06-01 17:11:51 -0400
commit98bb827799a3a61f7b4ccc09b9849eaf579312d5 (patch)
treedaa2d93159ea782fd569f679f9708e48ec9e121e /pkgs/tools/system
parent052fa90e82d01e866c9a130d58f1a72fc007c4ac (diff)
downloadnixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.tar
nixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.tar.gz
nixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.tar.bz2
nixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.tar.lz
nixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.tar.xz
nixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.tar.zst
nixlib-98bb827799a3a61f7b4ccc09b9849eaf579312d5.zip
runit: Add Darwin Compatibility
Not much modification is required to build and run runit on MacOS, all
that was needed was to follow runit's instructions [0] with some
guidance from homebrew's formula. [1]

0: http://smarden.org/runit/install.html
1: https://github.com/Homebrew/homebrew-core/blob/1cf1e61/Formula/runit.rb
Diffstat (limited to 'pkgs/tools/system')
-rw-r--r--pkgs/tools/system/runit/default.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/tools/system/runit/default.nix b/pkgs/tools/system/runit/default.nix
index a4319fd57496..acca0acf3ef9 100644
--- a/pkgs/tools/system/runit/default.nix
+++ b/pkgs/tools/system/runit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, fetchurl, darwin
 
 # Build runit-init as a static binary
 , static ? false
@@ -23,7 +23,8 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  buildInputs = stdenv.lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ];
+  buildInputs = stdenv.lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
+    stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.libs.utmp;
 
   postPatch = ''
     sed -i "s,\(#define RUNIT\) .*,\1 \"$out/bin/runit\"," src/runit.h
@@ -39,7 +40,7 @@ stdenv.mkDerivation rec {
 
     # Both of these are originally hard-coded to gcc
     echo ${stdenv.cc.targetPrefix}cc > conf-cc
-    echo ${stdenv.cc.targetPrefix}cc > conf-ld
+    echo ${stdenv.cc.targetPrefix}cc ${stdenv.lib.optionalString stdenv.isDarwin "-Xlinker -x "}> conf-ld
   '';
 
   installPhase = ''
@@ -55,6 +56,6 @@ stdenv.mkDerivation rec {
     license = licenses.bsd3;
     homepage = "http://smarden.org/runit";
     maintainers = with maintainers; [ joachifm ];
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }