about summary refs log tree commit diff
path: root/pkgs/by-name/sc
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-02-23 00:43:55 +0100
committerGitHub <noreply@github.com>2024-02-23 00:43:55 +0100
commit78745f4652acc9949d47838b4260b3d7d163da1c (patch)
tree7fabb49dba0eb7326226d20b38cfe43d8fc2ba7e /pkgs/by-name/sc
parentd7414fb8b0707d96b3a51cf80fd81a69733d07e0 (diff)
parentc7254aed3b25aa79bee944a8a1a63a41bca6cc54 (diff)
Merge pull request #289934 from jnsgruk/scrutiny
Diffstat (limited to 'pkgs/by-name/sc')
-rw-r--r--pkgs/by-name/sc/scrutiny-collector/package.nix53
-rw-r--r--pkgs/by-name/sc/scrutiny/package.nix68
2 files changed, 121 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;
+  };
+}
diff --git a/pkgs/by-name/sc/scrutiny/package.nix b/pkgs/by-name/sc/scrutiny/package.nix
new file mode 100644
index 0000000000000..5ca6a86e9dc1f
--- /dev/null
+++ b/pkgs/by-name/sc/scrutiny/package.nix
@@ -0,0 +1,68 @@
+{ buildNpmPackage
+, buildGoModule
+, fetchFromGitHub
+, nixosTests
+, lib
+}:
+let
+  pname = "scrutiny";
+  version = "0.7.2";
+
+  src = fetchFromGitHub {
+    owner = "AnalogJ";
+    repo = "scrutiny";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-UYKi+WTsasUaE6irzMAHr66k7wXyec8FXc8AWjEk0qs=";
+  };
+
+  frontend = buildNpmPackage {
+    inherit version;
+    pname = "${pname}-webapp";
+    src = "${src}/webapp/frontend";
+
+    npmDepsHash = "sha256-M8P41LPg7oJ/C9abDuNM5Mn+OO0zK56CKi2BwLxv8oQ=";
+
+    buildPhase = ''
+      runHook preBuild
+      mkdir dist
+      npm run build:prod --offline -- --output-path=dist
+      runHook postBuild
+    '';
+
+    installPhase = ''
+      runHook preInstall
+      mkdir $out
+      cp -r dist/* $out
+      runHook postInstall
+    '';
+  };
+in
+buildGoModule rec {
+  inherit pname src version;
+
+  subPackages = "webapp/backend/cmd/scrutiny";
+
+  vendorHash = "sha256-SiQw6pq0Fyy8Ia39S/Vgp9Mlfog2drtVn43g+GXiQuI=";
+
+  CGO_ENABLED = 0;
+
+  ldflags = [ "-extldflags=-static" ];
+
+  tags = [ "static" ];
+
+  postInstall = ''
+    mkdir -p $out/share/scrutiny
+    cp -r ${frontend}/* $out/share/scrutiny
+  '';
+
+  passthru.tests.scrutiny = nixosTests.scrutiny;
+
+  meta = {
+    description = "Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds.";
+    homepage = "https://github.com/AnalogJ/scrutiny";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ jnsgruk ];
+    mainProgram = "scrutiny";
+    platforms = lib.platforms.linux;
+  };
+}