mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 00:24:18 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
62 lines
1.6 KiB
Nix
62 lines
1.6 KiB
Nix
{ lib, stdenv, fetchurl, darwin
|
|
|
|
# Build runit-init as a static binary
|
|
, static ? false
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "runit";
|
|
version = "2.1.2";
|
|
|
|
src = fetchurl {
|
|
url = "http://smarden.org/runit/${pname}-${version}.tar.gz";
|
|
sha256 = "065s8w62r6chjjs6m9hapcagy33m75nlnxb69vg0f4ngn061dl3g";
|
|
};
|
|
|
|
patches = [
|
|
./fix-ar-ranlib.patch
|
|
];
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
sourceRoot = "admin/${pname}-${version}";
|
|
|
|
doCheck = true;
|
|
|
|
buildInputs = lib.optionals static [ stdenv.cc.libc stdenv.cc.libc.static ] ++
|
|
lib.optional stdenv.hostPlatform.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
|
|
'' + lib.optionalString (!static) ''
|
|
sed -i 's,-static,,g' src/Makefile
|
|
'';
|
|
|
|
preBuild = ''
|
|
cd src
|
|
|
|
# Both of these are originally hard-coded to gcc
|
|
echo ${stdenv.cc.targetPrefix}cc > conf-cc
|
|
echo ${stdenv.cc.targetPrefix}cc ${lib.optionalString stdenv.hostPlatform.isDarwin "-Xlinker -x "}> conf-ld
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp -t $out/bin $(< ../package/commands)
|
|
|
|
mkdir -p $man/share/man
|
|
cp -r ../man $man/share/man/man8
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "UNIX init scheme with service supervision";
|
|
license = licenses.bsd3;
|
|
homepage = "http://smarden.org/runit";
|
|
maintainers = with maintainers; [ joachifm ];
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
};
|
|
}
|