From a34e8fe1617420b9df728834fe2a6b0f1b32417a Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 10 Jul 2023 01:29:45 -0300 Subject: [PATCH] findup: use zigHook Also, a cosmetic refactor: - Reorder parameter listing - Use rec-less, overlay-style overridable recursive attributes (in effect since NixOS#119942); - Remove nested with (according to https://nix.dev/recipes/best-practices#with-scopes) --- pkgs/tools/misc/findup/default.nix | 43 ++++++++++++------------------ 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/pkgs/tools/misc/findup/default.nix b/pkgs/tools/misc/findup/default.nix index 358f4a30f3b9..11bf1918574d 100644 --- a/pkgs/tools/misc/findup/default.nix +++ b/pkgs/tools/misc/findup/default.nix @@ -1,39 +1,30 @@ -{ lib, stdenv, fetchFromGitHub, zig, testers, findup }: +{ lib +, stdenv +, fetchFromGitHub +, findup +, testers +, zigHook +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "findup"; version = "1.1.1"; src = fetchFromGitHub { owner = "booniepepper"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-Tpyiy5oJQ04lqVEOFshFC0+90VoNILQ+N6Dd7lbuH/Q="; + repo = "findup"; + rev = "v${finalAttrs.version}"; + hash = "sha256-Tpyiy5oJQ04lqVEOFshFC0+90VoNILQ+N6Dd7lbuH/Q="; }; - nativeBuildInputs = [ zig ]; + nativeBuildInputs = [ zigHook ]; - # Builds and installs (at the same time) with Zig. - dontConfigure = true; - dontBuild = true; + passthru.tests.version = testers.testVersion { package = finalAttrs.findup; }; - # Give Zig a directory for intermediate work. - preInstall = '' - export HOME=$TMPDIR - ''; - - installPhase = '' - runHook preInstall - zig build -Drelease-safe -Dcpu=baseline --prefix $out - runHook postInstall - ''; - - passthru.tests.version = testers.testVersion { package = findup; }; - - meta = with lib; { + meta = { homepage = "https://github.com/booniepepper/findup"; description = "Search parent directories for sentinel files"; - license = licenses.mit; - maintainers = with maintainers; [ booniepepper ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ booniepepper ]; }; -} +})