about summary refs log tree commit diff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/detekt/default.nix38
-rw-r--r--pkgs/development/tools/gotags/default.nix18
-rw-r--r--pkgs/development/tools/manifest-tool/default.nix51
3 files changed, 103 insertions, 4 deletions
diff --git a/pkgs/development/tools/detekt/default.nix b/pkgs/development/tools/detekt/default.nix
new file mode 100644
index 0000000000000..0c67c5dd66a93
--- /dev/null
+++ b/pkgs/development/tools/detekt/default.nix
@@ -0,0 +1,38 @@
+{ detekt, lib, stdenv, fetchurl, makeWrapper, jre_headless, testers }:
+stdenv.mkDerivation rec {
+  pname = "detekt";
+  version = "1.22.0";
+
+  jarfilename = "${pname}-${version}-executable.jar";
+
+  src = fetchurl {
+    url = "https://github.com/detekt/detekt/releases/download/v${version}/detekt-cli-${version}-all.jar";
+    sha256 = "sha256-NCOMBcAtk7cOlP3H8Bz/hfR/305j/DfaoFrwc504b/4=";
+  };
+
+  dontUnpack = true;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D "$src" "$out/share/java/${jarfilename}"
+
+    makeWrapper ${jre_headless}/bin/java $out/bin/detekt \
+      --add-flags "-jar $out/share/java/${jarfilename}"
+
+    runHook postInstall
+  '';
+
+  passthru.tests.version = testers.testVersion { package = detekt; };
+
+  meta = with lib; {
+    description = "Static code analysis for Kotlin";
+    homepage = "https://detekt.dev/";
+    license = licenses.asl20;
+    platforms = jre_headless.meta.platforms;
+    maintainers = with maintainers; [ mdr ];
+    sourceProvenance = with sourceTypes; [ binaryBytecode ];
+  };
+}
diff --git a/pkgs/development/tools/gotags/default.nix b/pkgs/development/tools/gotags/default.nix
index c4c0b7cbb06fb..9fa71187aa31f 100644
--- a/pkgs/development/tools/gotags/default.nix
+++ b/pkgs/development/tools/gotags/default.nix
@@ -1,6 +1,6 @@
-{ lib, buildGoPackage, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, fetchpatch }:
 
-buildGoPackage rec {
+buildGoModule rec {
   pname = "gotags";
   version = "1.4.1";
 
@@ -8,10 +8,20 @@ buildGoPackage rec {
     owner = "jstemmer";
     repo = pname;
     rev = "4c0c4330071a994fbdfdff68f412d768fbcca313";
-    sha256 = "sha256-cHTgt+zW6S6NDWBE6NxSXNPdn84CLD8WmqBe+uXN8sA=";
+    hash = "sha256-cHTgt+zW6S6NDWBE6NxSXNPdn84CLD8WmqBe+uXN8sA=";
   };
 
-  goPackagePath = "github.com/jstemmer/gotags";
+  vendorHash = null;
+
+  patches = [
+    # Add Go Modules support
+    (fetchpatch {
+      url = "https://github.com/jstemmer/gotags/commit/9146999bce9a88e15b5f123d1aa1613926dd9a9c.patch";
+      hash = "sha256-6v/Ws15y50S6iCI1c0kEw5WHSg+1WqVT4mwdQKoi5G8=";
+    })
+  ];
+
+  ldflags = [ "-s" "-w" ];
 
   meta = with lib; {
     description = "ctags-compatible tag generator for Go";
diff --git a/pkgs/development/tools/manifest-tool/default.nix b/pkgs/development/tools/manifest-tool/default.nix
new file mode 100644
index 0000000000000..6282619535b92
--- /dev/null
+++ b/pkgs/development/tools/manifest-tool/default.nix
@@ -0,0 +1,51 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, git
+, stdenv
+, testers
+, manifest-tool
+}:
+
+buildGoModule rec {
+  pname = "manifest-tool";
+  version = "2.0.6";
+  gitCommit = "2ed9312726765567a84f2acc44a0c8a6e50f4b7a";
+  modRoot = "v2";
+
+  src = fetchFromGitHub {
+    owner = "estesp";
+    repo = "manifest-tool";
+    rev = "v${version}";
+    sha256 = "sha256-oopk++IdNF6msxOszT0fKxQABgWKbaQZ2aNH9chqWU0=";
+    leaveDotGit = true;
+    postFetch = ''
+      git -C $out rev-parse HEAD > $out/.git-revision
+      rm -rf $out/.git
+    '';
+  };
+
+  vendorHash = null;
+
+  nativeBuildInputs = [ git ];
+
+  preConfigure = ''
+    ldflags="-X main.gitCommit=$(cat .git-revision)"
+  '';
+
+  CGO_ENABLED = if stdenv.hostPlatform.isStatic then "0" else "1";
+  GO_EXTLINK_ENABLED = if stdenv.hostPlatform.isStatic then "0" else "1";
+  ldflags = lib.optionals stdenv.hostPlatform.isStatic [ "-w" "-extldflags" "-static" ];
+  tags = lib.optionals stdenv.hostPlatform.isStatic [ "netgo" ];
+
+  passthru.tests.version = testers.testVersion {
+    package = manifest-tool;
+  };
+
+  meta = with lib; {
+    description = "Command line tool to create and query container image manifest list/indexes";
+    homepage = "https://github.com/estesp/manifest-tool";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ tricktron ];
+  };
+}