From b49f2301a43c9d97ce384ed220f2c9308b8d6d20 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Sat, 11 Jan 2025 14:06:23 +1100 Subject: [PATCH] rar2hashcat: init at 1.0 --- pkgs/by-name/ra/rar2hashcat/darwin-support.patch | 24 +++++++++++++ pkgs/by-name/ra/rar2hashcat/package.nix | 46 ++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 pkgs/by-name/ra/rar2hashcat/darwin-support.patch create mode 100644 pkgs/by-name/ra/rar2hashcat/package.nix diff --git a/pkgs/by-name/ra/rar2hashcat/darwin-support.patch b/pkgs/by-name/ra/rar2hashcat/darwin-support.patch new file mode 100644 index 000000000000..26979c2eb3fa --- /dev/null +++ b/pkgs/by-name/ra/rar2hashcat/darwin-support.patch @@ -0,0 +1,24 @@ +diff --git a/Makefile b/Makefile +index eca86a9..f11931b 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,5 @@ + # Common variables +-CFLAGS = -g -static -O2 -D_GNU_SOURCE -DARCH_LITTLE_ENDIAN=1 ++CFLAGS = -g -O2 -D_GNU_SOURCE -DARCH_LITTLE_ENDIAN=1 + TARGET = rar2hashcat + + # Variables for Linux target +diff --git a/base64_convert.c b/base64_convert.c +index 0d2635d..b101e3c 100644 +--- a/base64_convert.c ++++ b/base64_convert.c +@@ -163,7 +163,7 @@ static char *strnzcpy(char *dst, const char *src, int size) + return dst; + } + +-#ifdef __linux__ ++#if defined(__linux__) || defined(__APPLE__) + static char *strupr(char *s) + { + unsigned char *ptr = (unsigned char *)s; diff --git a/pkgs/by-name/ra/rar2hashcat/package.nix b/pkgs/by-name/ra/rar2hashcat/package.nix new file mode 100644 index 000000000000..fe0d5733e920 --- /dev/null +++ b/pkgs/by-name/ra/rar2hashcat/package.nix @@ -0,0 +1,46 @@ +{ + lib, + stdenv, + fetchFromGitHub, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rar2hashcat"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "hashstation"; + repo = "rar2hashcat"; + rev = finalAttrs.version; + hash = "sha256-GVh4Gyjn84xAwO7wKXYe2DPnpb8gnxGIMH5Szce+XpY="; + }; + + patches = [ + ./darwin-support.patch + ]; + + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=implicit-function-declaration -Wno-error=int-conversion"; + + makeFlags = [ + "CC_LINUX=${stdenv.cc.targetPrefix}cc" + "rar2hashcat" + ]; + + installPhase = '' + runHook preInstall + + install -D rar2hashcat $out/bin/rar2hashcat + + runHook postInstall + ''; + + meta = { + changelog = "https://github.com/hashstation/rar2hashcat/releases/tag/${finalAttrs.version}"; + description = "Processes input RAR files into a format suitable for use with hashcat"; + homepage = "https://github.com/hashstation/rar2hashcat"; + license = lib.licenses.mit; + mainProgram = "rar2hashcat"; + maintainers = with lib.maintainers; [ emilytrau ]; + platforms = lib.platforms.unix; + }; +}) -- 2.11.4.GIT