about summary refs log tree commit diff
path: root/pkgs/tools/misc/findup/default.nix
blob: 0b7d687922f457c0516e1500e9ee035fa61a044e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ lib, stdenv, fetchFromGitHub, zig, testers, findup }:

stdenv.mkDerivation rec {
  pname = "findup";
  version = "1.0";

  src = fetchFromGitHub {
    owner = "hiljusti";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-erlKIiYYlWnhoeD3FnKdxnHjfGmmJVXk44DUja5Unig=";
  };

  nativeBuildInputs = [ zig ];

  # Builds and installs (at the same time) with Zig.
  dontConfigure = true;
  dontBuild = true;

  # 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; {
    homepage = "https://github.com/hiljusti/findup";
    description = "Search parent directories for sentinel files";
    license = licenses.mit;
    maintainers = with maintainers; [ hiljusti ];
  };
}