;;; guix-arunisaac --- arunisaac's Guix odds and ends ;;; Copyright © 2020 Christopher Baines ;;; Copyright © 2026 Arun Isaac ;;; ;;; This file is part of guix-arunisaac. ;;; ;;; guix-arunisaac is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; guix-arunisaac is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with guix-arunisaac. If not, see ;;; . (define-module (arunisaac prometheus) #:use-module (guix build-system go) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages)) ;; This package definition is based on ;; https://codeberg.org/cbaines/guix/commit/9cb1166151b795ba6aaaf9db11e31cfc3f124c1d (define-public prometheus (package (name "prometheus") (version "2.17.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/prometheus/prometheus.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1r7zpq6647lrm7cmid6nnf2xnljqh1i9g0fxvs0qrfd2sxxgj0c7")))) (build-system go-build-system) (arguments (list #:unpack-path "github.com/prometheus/prometheus" #:import-path "github.com/prometheus/prometheus/cmd/prometheus" #:install-source? #f #:phases #~(modify-phases %standard-phases (add-after 'unpack 'patch (lambda* (#:key outputs #:allow-other-keys) (let ((assets-prefix (string-append (assoc-ref outputs "out") "/var/lib/prometheus/assets"))) (substitute* "src/github.com/prometheus/prometheus/web/ui/ui.go" (("var assetsPrefix string") (string-append "var assetsPrefix string = \"" assets-prefix "\"")))))) (add-after 'install 'install-assets (lambda* (#:key outputs #:allow-other-keys) (let ((assets-prefix (string-append (assoc-ref outputs "out") "/var/lib/prometheus/assets"))) (for-each (lambda (directory) (copy-recursively (string-append "src/github.com/prometheus/prometheus" "/web/ui/" directory) (string-append assets-prefix "/" directory))) (list "static" "templates")))))))) (home-page "https://prometheus.io/") (synopsis "Metrics, monitoring and alerting toolkit") (description "Prometheus is an open-source systems monitoring and alerting toolkit. Prometheus collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.") (license license:asl2.0)))