about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorThomas Gerbet <thomas@gerbet.me>2024-01-03 23:58:02 +0100
committerGitHub <noreply@github.com>2024-01-03 23:58:02 +0100
commit054533f5c84884e3186a722c07cbb4a6c1a2af19 (patch)
tree8f05316f21e8decbb56de6b63563650a083bea15 /pkgs
parenta1969899b173aeae354f62be81cf473b0fdc793f (diff)
parent935d25c7e6ad39ef1018accf256710f2e3155a34 (diff)
Merge pull request #214029 from LeSuisse/ripunzip-init-0.4.0
ripunzip: init at 1.1.0
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/ri/ripunzip/package.nix48
-rw-r--r--pkgs/by-name/ri/ripunzip/setup-hook.sh6
2 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/by-name/ri/ripunzip/package.nix b/pkgs/by-name/ri/ripunzip/package.nix
new file mode 100644
index 0000000000000..3dcdf976fcaae
--- /dev/null
+++ b/pkgs/by-name/ri/ripunzip/package.nix
@@ -0,0 +1,48 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, rustPlatform
+, openssl
+, darwin
+, pkg-config
+, testers
+, fetchzip
+, ripunzip
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "ripunzip";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "ripunzip";
+    rev = "v${version}";
+    hash = "sha256-GyP4OPnPKhu9nXYXIfWCVLF/thwWiP0OqAQY/1D05LE=";
+  };
+
+  cargoHash = "sha256-Jv9bCHT5xl/2CPnSuWd9HZuaGOttBC5iAbbpr3jaIhM=";
+
+  buildInputs = [ openssl ]
+    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration ]);
+  nativeBuildInputs = [ pkg-config ];
+
+  setupHook = ./setup-hook.sh;
+
+  passthru.tests = {
+    fetchzipWithRipunzip = testers.invalidateFetcherByDrvHash (fetchzip.override { unzip = ripunzip; }) {
+      url = "https://github.com/google/ripunzip/archive/cb9caa3ba4b0e27a85e165be64c40f1f6dfcc085.zip";
+      hash = "sha256-BoErC5VL3Vpvkx6xJq6J+eUJrBnjVEdTuSo7zh98Jy4=";
+    };
+    version = testers.testVersion {
+      package = ripunzip;
+    };
+  };
+
+  meta = with lib; {
+    description = "A tool to unzip files in parallel";
+    homepage = "https://github.com/google/ripunzip";
+    license = with lib.licenses; [ mit asl20 ];
+    maintainers = [ maintainers.lesuisse ];
+  };
+}
diff --git a/pkgs/by-name/ri/ripunzip/setup-hook.sh b/pkgs/by-name/ri/ripunzip/setup-hook.sh
new file mode 100644
index 0000000000000..fc009db4cd3ff
--- /dev/null
+++ b/pkgs/by-name/ri/ripunzip/setup-hook.sh
@@ -0,0 +1,6 @@
+unpackCmdHooks+=(_tryRipunzip)
+_tryRipunzip() {
+    if ! [[ "$curSrc" =~ \.zip$ ]]; then return 1; fi
+
+    ripunzip unzip-file "$curSrc" 2> /dev/null
+}