about summary refs log tree commit diff
path: root/pkgs/tools/misc/findup
diff options
context:
space:
mode:
authorhiljusti <hiljusti@so.dang.cool>2022-01-13 01:18:09 -0800
committerhiljusti <hiljusti@so.dang.cool>2022-07-20 11:37:34 -0700
commitf78e768d4971cabd98bf078f2c0113aafbd939f8 (patch)
tree6177aaf4ac341fc44897de7831f605a6de800dd3 /pkgs/tools/misc/findup
parentee480d0711d8dcc029f8592f8f7460db4a875496 (diff)
findup: init at 1.0
Diffstat (limited to 'pkgs/tools/misc/findup')
-rw-r--r--pkgs/tools/misc/findup/default.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/tools/misc/findup/default.nix b/pkgs/tools/misc/findup/default.nix
new file mode 100644
index 0000000000000..0b7d687922f45
--- /dev/null
+++ b/pkgs/tools/misc/findup/default.nix
@@ -0,0 +1,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 ];
+  };
+}