Skip to content

Instantly share code, notes, and snippets.

@yorickvP
Last active September 11, 2019 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorickvP/be90114b26384c671c2ce69009f01fed to your computer and use it in GitHub Desktop.
Save yorickvP/be90114b26384c671c2ce69009f01fed to your computer and use it in GitHub Desktop.
{ stdenv, musl, netbsd }:
let
getconf = builtins.fetchurl https://raw.githubusercontent.com/alpinelinux/aports/master/main/musl/getconf.c;
getent = builtins.fetchurl https://raw.githubusercontent.com/alpinelinux/aports/master/main/musl/getent.c;
isMusl = stdenv.hostPlatform.isMusl;
in
stdenv.mkDerivation {
pname = "musl-bin";
version = musl.version;
srcs = [
getconf
getent
];
buildInputs = [ musl ];
unpackPhase = ''
cp $srcs .
'';
buildPhase = ''
${if !isMusl then "musl-gcc" else "$CC"} *-getconf.c -o getconf
${if !isMusl then "musl-gcc" else "$CC"} *-getent.c -o getent
'';
installPhase = ''
mkdir -p $out/bin
install -D ./getconf ./getent $out/bin
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment