about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
author0x4A6F <0x4A6F@users.noreply.github.com>2022-01-08 17:01:24 +0100
committerGitHub <noreply@github.com>2022-01-08 17:01:24 +0100
commit959d10e4b9caf509b095bba4f0daeddb10a361cb (patch)
tree3d65384a0724428b10ef5c4aa55604e906e0e9e0 /pkgs/tools
parentf8153418c491d9ec59af7cc59fb0147ad65a9ebc (diff)
parent62c344c7a28b82db849f094602a3773354c2cd20 (diff)
Merge pull request #150431 from Enzime/add/comma
comma: init at 1.1.0
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/package-management/comma/default.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/tools/package-management/comma/default.nix b/pkgs/tools/package-management/comma/default.nix
new file mode 100644
index 0000000000000..1cd8ac8ccd48c
--- /dev/null
+++ b/pkgs/tools/package-management/comma/default.nix
@@ -0,0 +1,55 @@
+{ lib
+, stdenv
+, fetchurl
+, fetchFromGitHub
+, linkFarm
+, nix-index
+, fzy
+}:
+
+let
+
+  # nix-index takes a little while to run and the contents don't change
+  # meaningfully very often.
+  indexCache = fetchurl {
+    url = "https://github.com/Mic92/nix-index-database/releases/download/2021-12-12/index-x86_64-linux";
+    sha256 = "sha256-+SoG5Qz2KWA/nIWXE6SLpdi8MDqTs8LY90fGZxGKOiA=";
+  };
+
+  # nix-locate needs the --db argument to be a directory containing a file
+  # named "files".
+  nixIndexDB = linkFarm "nix-index-cache" [
+    { name = "files"; path = indexCache; }
+  ];
+
+in stdenv.mkDerivation rec {
+  pname = "comma";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "nix-community";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-WBIQmwlkb/GMoOq+Dnyrk8YmgiM/wJnc5HYZP8Uw72E=";
+  };
+
+  postPatch = ''
+    substituteInPlace , \
+      --replace '$PREBUILT_NIX_INDEX_DB' "${nixIndexDB}" \
+      --replace nix-locate "${nix-index}/bin/nix-locate" \
+      --replace fzy "${fzy}/bin/fzy"
+  '';
+
+  installPhase = ''
+    install -Dm755 , -t $out/bin
+    ln -s $out/bin/, $out/bin/comma
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/nix-community/comma";
+    description = "Run software without installing it";
+    license = licenses.mit;
+    maintainers = with maintainers; [ Enzime ];
+    platforms = platforms.all;
+  };
+}