about summary refs log tree commit diff
path: root/pkgs/by-name/sc
diff options
context:
space:
mode:
authorJon Seager <jon@sgrs.uk>2024-02-19 09:45:17 +0000
committerJon Seager <jon@sgrs.uk>2024-02-22 21:20:09 +0000
commit96d9e2a14c5fa9aa8b80721ebdb31ce7e9ff2dd2 (patch)
tree6e6bda315fda525e4d43a879d7b875b93603c715 /pkgs/by-name/sc
parent41f9a37ee4b3421f06c9d3b794cb07a05dd4fc96 (diff)
scrutiny-collector: init at 0.7.2
Diffstat (limited to 'pkgs/by-name/sc')
-rw-r--r--pkgs/by-name/sc/scrutiny-collector/package.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/by-name/sc/scrutiny-collector/package.nix b/pkgs/by-name/sc/scrutiny-collector/package.nix
new file mode 100644
index 0000000000000..2c1ec9efb27fc
--- /dev/null
+++ b/pkgs/by-name/sc/scrutiny-collector/package.nix
@@ -0,0 +1,53 @@
+{ buildGoModule
+, fetchFromGitHub
+, makeWrapper
+, smartmontools
+, nixosTests
+, lib
+}:
+let
+  version = "0.7.2";
+in
+buildGoModule rec {
+  inherit version;
+  pname = "scrutiny-collector";
+
+  src = fetchFromGitHub {
+    owner = "AnalogJ";
+    repo = "scrutiny";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-UYKi+WTsasUaE6irzMAHr66k7wXyec8FXc8AWjEk0qs=";
+  };
+
+  subPackages = "collector/cmd/collector-metrics";
+
+  vendorHash = "sha256-SiQw6pq0Fyy8Ia39S/Vgp9Mlfog2drtVn43g+GXiQuI=";
+
+  buildInputs = [ makeWrapper ];
+
+  CGO_ENABLED = 0;
+
+  ldflags = [ "-extldflags=-static" ];
+
+  tags = [ "static" ];
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/bin
+    cp $GOPATH/bin/collector-metrics $out/bin/scrutiny-collector-metrics
+    wrapProgram $out/bin/scrutiny-collector-metrics \
+      --prefix PATH : ${lib.makeBinPath [ smartmontools ]}
+    runHook postInstall
+  '';
+
+  passthru.tests.scrutiny-collector = nixosTests.scrutiny;
+
+  meta = {
+    description = "Hard disk metrics collector for Scrutiny.";
+    homepage = "https://github.com/AnalogJ/scrutiny";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ jnsgruk ];
+    mainProgram = "scrutiny-collector-metrics";
+    platforms = lib.platforms.linux;
+  };
+}