Skip to content

Commit

Permalink
runit: Add Darwin Compatibility
Browse files Browse the repository at this point in the history
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
  • Loading branch information
afontaine committed Jun 1, 2020
1 parent 052fa90 commit 98bb827
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkgs/tools/system/runit/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchurl
{ stdenv, fetchurl, darwin

# Build runit-init as a static binary
, static ? false
Expand All @@ -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
Expand All @@ -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 = ''
Expand All @@ -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;
};
}

0 comments on commit 98bb827

Please sign in to comment.