nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 zig,
6 testers,
7 installShellFiles,
8 zf,
9}:
10stdenv.mkDerivation rec {
11 pname = "zf";
12 version = "0.8.0";
13
14 src = fetchFromGitHub {
15 owner = "natecraddock";
16 repo = pname;
17 rev = "refs/tags/${version}";
18 fetchSubmodules = true;
19 hash = "sha256-MzlSU5x2lb6PJZ/iNAi2aebfuClBprlfHMIG/4OPmuc=";
20 };
21
22 nativeBuildInputs = [ zig installShellFiles ];
23
24 preBuild = ''
25 export HOME=$TMPDIR
26 '';
27
28 buildPhase = ''
29 runHook preBuild
30 zig build -Drelease-safe -Dcpu=baseline
31 runHook postBuild
32 '';
33
34 doCheck = true;
35 checkPhase = ''
36 runHook preCheck
37 zig build test
38 runHook postCheck
39 '';
40
41 installPhase = ''
42 runHook preInstall
43 zig build -Drelease-safe -Dcpu=baseline --prefix $out install
44 installManPage doc/zf.1
45 installShellCompletion \
46 --bash complete/zf \
47 --fish complete/zf.fish \
48 --zsh complete/_zf
49 runHook postInstall
50 '';
51
52 passthru.tests.version = testers.testVersion {package = zf;};
53
54 meta = with lib; {
55 homepage = "https://github.com/natecraddock/zf";
56 description = "A commandline fuzzy finder that prioritizes matches on filenames";
57 license = licenses.mit;
58 platforms = platforms.unix;
59 maintainers = with maintainers; [ dit7ya mmlb ];
60 };
61}