2019-02-07 00:59:38 +00:00
|
|
|
{
|
2019-03-01 00:55:11 +00:00
|
|
|
stdenv, lib, fetchFromGitHub, which,
|
2019-02-07 00:59:38 +00:00
|
|
|
enableStatic ? false,
|
|
|
|
enableMinimal ? false,
|
|
|
|
extraConfig ? ""
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "toybox";
|
2019-10-24 18:00:52 +00:00
|
|
|
version = "0.8.2";
|
2019-02-07 00:59:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "landley";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2019-10-24 18:00:52 +00:00
|
|
|
sha256 = "02mliqz2lry779ba6vmyaa13nxcmj91f8pyhzim9wvcnjq8vc5cj";
|
2019-02-07 00:59:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = lib.optionals enableStatic [ stdenv.cc.libc stdenv.cc.libc.static ];
|
|
|
|
|
2019-03-01 00:55:11 +00:00
|
|
|
postPatch = "patchShebangs .";
|
2019-02-07 00:59:38 +00:00
|
|
|
|
|
|
|
inherit extraConfig;
|
|
|
|
passAsFile = [ "extraConfig" ];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
make ${if enableMinimal then
|
|
|
|
"allnoconfig"
|
|
|
|
else
|
|
|
|
if stdenv.isFreeBSD then
|
|
|
|
"freebsd_defconfig"
|
|
|
|
else
|
|
|
|
if stdenv.isDarwin then
|
|
|
|
"macos_defconfig"
|
|
|
|
else
|
|
|
|
"defconfig"
|
|
|
|
}
|
|
|
|
|
|
|
|
cat $extraConfigPath .config > .config-
|
|
|
|
mv .config- .config
|
|
|
|
|
|
|
|
make oldconfig
|
|
|
|
'';
|
|
|
|
|
2019-03-01 00:55:11 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)/bin" ] ++ lib.optional enableStatic "LDFLAGS=--static";
|
|
|
|
|
2019-11-04 12:33:53 +00:00
|
|
|
installTargets = [ "install_flat" ];
|
2019-02-07 00:59:38 +00:00
|
|
|
|
|
|
|
# tests currently (as of 0.8.0) get stuck in an infinite loop...
|
|
|
|
# ...this is fixed in latest git, so doCheck can likely be enabled for next release
|
|
|
|
# see https://github.com/landley/toybox/commit/b928ec480cd73fd83511c0f5ca786d1b9f3167c3
|
|
|
|
#doCheck = true;
|
2019-03-01 00:55:11 +00:00
|
|
|
checkInputs = [ which ]; # used for tests with checkFlags = [ "DEBUG=true" ];
|
2019-02-07 00:59:38 +00:00
|
|
|
checkTarget = "tests";
|
|
|
|
|
2019-04-23 02:36:35 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error";
|
|
|
|
|
2019-02-07 00:59:38 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Lightweight implementation of some Unix command line utilities";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://landley.net/toybox/";
|
2019-02-07 00:59:38 +00:00
|
|
|
license = licenses.bsd0;
|
|
|
|
platforms = with platforms; linux ++ darwin ++ freebsd;
|
|
|
|
maintainers = with maintainers; [ hhm ];
|
|
|
|
priority = 10;
|
|
|
|
};
|
|
|
|
}
|