From fe310a185539159f1de46c0728fcceaa65c37f90 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 9 Jul 2023 20:37:39 -0300 Subject: [PATCH] zf: 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/zf/default.nix | 59 +++++++++++++--------------------- 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/pkgs/tools/misc/zf/default.nix b/pkgs/tools/misc/zf/default.nix index a34e85def589..691606b52c40 100644 --- a/pkgs/tools/misc/zf/default.nix +++ b/pkgs/tools/misc/zf/default.nix @@ -1,61 +1,46 @@ -{ - lib, - stdenv, - fetchFromGitHub, - zig, - testers, - installShellFiles, - zf, +{ lib +, stdenv +, fetchFromGitHub +, installShellFiles +, testers +, zf +, zigHook }: -stdenv.mkDerivation rec { + +stdenv.mkDerivation (finalAttrs: { pname = "zf"; version = "0.8.0"; src = fetchFromGitHub { owner = "natecraddock"; - repo = pname; - rev = "refs/tags/${version}"; + repo = "zf"; + rev = "refs/tags/${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-MzlSU5x2lb6PJZ/iNAi2aebfuClBprlfHMIG/4OPmuc="; }; - nativeBuildInputs = [ zig installShellFiles ]; - - preBuild = '' - export HOME=$TMPDIR - ''; - - buildPhase = '' - runHook preBuild - zig build -Drelease-safe -Dcpu=baseline - runHook postBuild - ''; + nativeBuildInputs = [ + installShellFiles + zigHook + ]; doCheck = true; - checkPhase = '' - runHook preCheck - zig build test - runHook postCheck - ''; - installPhase = '' - runHook preInstall - zig build -Drelease-safe -Dcpu=baseline --prefix $out install + postInstall = '' installManPage doc/zf.1 installShellCompletion \ --bash complete/zf \ --fish complete/zf.fish \ --zsh complete/_zf - runHook postInstall ''; - passthru.tests.version = testers.testVersion {package = zf;}; + passthru.tests.version = testers.testVersion { package = finalAttrs.zf; }; - meta = with lib; { + meta = { homepage = "https://github.com/natecraddock/zf"; description = "A commandline fuzzy finder that prioritizes matches on filenames"; - license = licenses.mit; - platforms = platforms.unix; - maintainers = with maintainers; [ dit7ya mmlb ]; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ dit7ya mmlb ]; }; -} +})