nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildNpmPackage,
3 buildGoModule,
4 fetchFromGitHub,
5 nixosTests,
6 lib,
7 nix-update-script,
8}:
9let
10 pname = "scrutiny";
11 version = "0.8.1";
12
13 src = fetchFromGitHub {
14 owner = "AnalogJ";
15 repo = "scrutiny";
16 tag = "v${version}";
17 hash = "sha256-WoU5rdsIEhZQ+kPoXcestrGXC76rFPvhxa0msXjFsNg=";
18 };
19
20 frontend = buildNpmPackage {
21 inherit version;
22 pname = "${pname}-webapp";
23 src = "${src}/webapp/frontend";
24
25 npmDepsHash = "sha256-M8P41LPg7oJ/C9abDuNM5Mn+OO0zK56CKi2BwLxv8oQ=";
26
27 buildPhase = ''
28 runHook preBuild
29 mkdir dist
30 npm run build:prod --offline -- --output-path=dist
31 runHook postBuild
32 '';
33
34 installPhase = ''
35 runHook preInstall
36 mkdir $out
37 cp -r dist/* $out
38 runHook postInstall
39 '';
40
41 passthru.updateScript = nix-update-script { };
42 };
43in
44buildGoModule rec {
45 inherit pname src version;
46
47 subPackages = "webapp/backend/cmd/scrutiny";
48
49 vendorHash = "sha256-SiQw6pq0Fyy8Ia39S/Vgp9Mlfog2drtVn43g+GXiQuI=";
50
51 env.CGO_ENABLED = 0;
52
53 ldflags = [ "-extldflags=-static" ];
54
55 tags = [ "static" ];
56
57 postInstall = ''
58 mkdir -p $out/share/scrutiny
59 cp -r ${frontend}/* $out/share/scrutiny
60 '';
61
62 passthru.tests.scrutiny = nixosTests.scrutiny;
63 passthru.updateScript = nix-update-script { };
64
65 meta = {
66 description = "Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds";
67 homepage = "https://github.com/AnalogJ/scrutiny";
68 changelog = "https://github.com/AnalogJ/scrutiny/releases/tag/v${version}";
69 license = lib.licenses.mit;
70 maintainers = [ ];
71 mainProgram = "scrutiny";
72 platforms = lib.platforms.linux;
73 };
74}