summary refs log tree commit diff
path: root/pkgs/tools/misc/toybox
diff options
context:
space:
mode:
authorhhm <heehooman+vcs-ci@gmail.com>2019-02-06 19:59:38 -0500
committerhhm <heehooman+vcs-ci@gmail.com>2019-02-27 20:49:39 -0500
commit88e69dbc520606a38a09ab5e910667ed153a5079 (patch)
tree28d9d45b7411b8242388954c9aaf0a7641fa6c4c /pkgs/tools/misc/toybox
parent1c4630b17ab4b3602d46453c2803670cb9dea131 (diff)
downloadnixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.tar
nixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.tar.gz
nixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.tar.bz2
nixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.tar.lz
nixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.tar.xz
nixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.tar.zst
nixpkgs-88e69dbc520606a38a09ab5e910667ed153a5079.zip
toybox: init at 0.8.0
B"H toybox package, supporting static building via enableStatic, and custom configurations via extraConfig and enableMinimal parameters
parseconfig shell function, and misc other parts, are based on busybox package derivation
Diffstat (limited to 'pkgs/tools/misc/toybox')
-rw-r--r--pkgs/tools/misc/toybox/default.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/tools/misc/toybox/default.nix b/pkgs/tools/misc/toybox/default.nix
new file mode 100644
index 00000000000..5a979be249e
--- /dev/null
+++ b/pkgs/tools/misc/toybox/default.nix
@@ -0,0 +1,62 @@
+{
+  stdenv, lib, fetchFromGitHub, buildPackages,
+  enableStatic ? false,
+  enableMinimal ? false,
+  extraConfig ? ""
+}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "toybox";
+  version = "0.8.0";
+
+  src = fetchFromGitHub {
+    owner = "landley";
+    repo = pname;
+    rev = version;
+    sha256 = "00q6vlc06xbhcjcyqkyp66d1pv7qgwhs00gk4vyixhjqh80giwzl";
+  };
+
+  buildInputs = lib.optionals enableStatic [ stdenv.cc.libc stdenv.cc.libc.static ];
+
+  postPatch = "patchShebangs scripts";
+
+  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
+  '';
+
+  makeFlags = [ "PREFIX=$(out)" ] ++ lib.optional enableStatic "LDFLAGS=--static";
+
+  # 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;
+  checkTarget = "tests";
+
+  meta = with stdenv.lib; {
+    description = "Lightweight implementation of some Unix command line utilities";
+    homepage = https://landley.net/toybox/;
+    license = licenses.bsd0;
+    platforms = with platforms; linux ++ darwin ++ freebsd;
+    maintainers = with maintainers; [ hhm ];
+    priority = 10;
+  };
+}