2 stdenv, lib, fetchFromGitHub, which,
3 buildPackages, libxcrypt, libiconv,
4 enableStatic ? stdenv.hostPlatform.isStatic,
10 inherit (lib) optionals;
13 stdenv.mkDerivation rec {
17 src = fetchFromGitHub {
21 sha256 = "sha256-7izs2C5/czec0Dt3apL8s7luARAlw4PfUFy9Xsxb0zw=";
24 depsBuildBuild = optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc ];
27 ] ++ optionals stdenv.hostPlatform.isDarwin [
29 ] ++ optionals (enableStatic && stdenv.cc.libc ? static) [
34 postPatch = "patchShebangs .";
37 passAsFile = [ "extraConfig" ];
40 make ${if enableMinimal then
43 if stdenv.hostPlatform.isFreeBSD then
46 if stdenv.hostPlatform.isDarwin then
52 cat $extraConfigPath .config > .config-
58 makeFlags = [ "PREFIX=$(out)/bin" ] ++ optionals enableStatic [ "LDFLAGS=--static" ];
60 installTargets = [ "install_flat" ];
62 # tests currently (as of 0.8.0) get stuck in an infinite loop...
63 # ...this is fixed in latest git, so doCheck can likely be enabled for next release
64 # see https://github.com/landley/toybox/commit/b928ec480cd73fd83511c0f5ca786d1b9f3167c3
66 nativeCheckInputs = [ which ]; # used for tests with checkFlags = [ "DEBUG=true" ];
67 checkTarget = "tests";
69 env.NIX_CFLAGS_COMPILE = "-Wno-error";
72 description = "Lightweight implementation of some Unix command line utilities";
73 homepage = "https://landley.net/toybox/";
74 license = licenses.bsd0;
75 platforms = with platforms; linux ++ darwin ++ freebsd;
76 maintainers = with maintainers; [ hhm ];