diff --git a/go.mod b/go.mod index e4f4633..26319f6 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/spf13/cast v1.10.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/subosito/gotenv v1.6.0 // indirect - go.yaml.in/yaml/v2 v2.4.3 // indirect + go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/text v0.34.0 // indirect diff --git a/go.sum b/go.sum index 4eb205f..ab24bc5 100644 --- a/go.sum +++ b/go.sum @@ -67,6 +67,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= +go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= +go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= diff --git a/nix/package.nix b/nix/package.nix index 58d7757..b630ee2 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,40 +1,55 @@ { lib, buildGoModule, -}: -buildGoModule (finalAttrs: { - pname = "watchdog"; - version = "0.1.0"; +}: let + versionInfo = lib.importJSON ../version.json; +in + buildGoModule (finalAttrs: { + pname = "watchdog"; + version = versionInfo.version; - src = let - fs = lib.fileset; - s = ../.; - in - fs.toSource { - root = s; - fileset = fs.unions [ - (s + /cmd) - (s + /internal) - (s + /go.mod) - (s + /go.sum) - ]; + src = let + fs = lib.fileset; + s = ../.; + in + fs.toSource { + root = s; + fileset = fs.unions [ + (s + /cmd) + (s + /internal) + (s + /web) + + (s + /go.mod) + (s + /go.sum) + + # Checkphase + (s + /test) + (s + /testdata) + (s + /version.json) + ]; + }; + + vendorHash = "sha256-qOCa/uj7GS1PYup12Z91zn9w3ovQg4XEHVOLCVP9qZk="; + + ldflags = [ + "-s" + "-w" + "-X main.Version=${finalAttrs.version}" + "-X main.Commit=${versionInfo.commit}" + "-X main.BuildDate=${versionInfo.buildDate}" + ]; + + # Copy web assets + postInstall = '' + mkdir -p $out/share/watchdog + cp -r $src/web $out/share/watchdog/ + ''; + + meta = { + description = "Privacy-preserving web analytics with Prometheus-native metrics"; + homepage = "https://github.com/notashelf/watchdog"; + license = lib.licenses.eupl12; + maintainers = with lib.maintainers; [NotAShelf]; + mainProgram = "watchdog"; }; - - vendorHash = "sha256-jMqPVvMZDm406Gi2g4zNSRJMySLAN7/CR/2NgF+gqtA="; - - ldflags = ["-s" "-w" "-X main.Version=${finalAttrs.version}"]; - - # Copy web assets - postInstall = '' - mkdir -p $out/share/watchdog - cp -r $src/web $out/share/watchdog/ - ''; - - meta = { - description = "Privacy-preserving web analytics with Prometheus-native metrics"; - homepage = "https://github.com/notashelf/watchdog"; - license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [NotAShelf]; - mainProgram = "watchdog"; - }; -}) + })