about summary refs log tree commit diff
path: root/arunisaac
diff options
context:
space:
mode:
authorArun Isaac2026-08-29 16:54:59 +0100
committerArun Isaac2026-08-29 21:03:04 +0100
commitaaa6f158b27a671d7b4537872f3b905ad088b5d6 (patch)
tree11149a1c1e7e3082c6c4cb29a84c79e1e548f1dd /arunisaac
parent0c811a1be83f61c9f6860c1d692e818c0e403e5d (diff)
downloadguix-arunisaac-aaa6f158b27a671d7b4537872f3b905ad088b5d6.tar.gz
guix-arunisaac-aaa6f158b27a671d7b4537872f3b905ad088b5d6.tar.lz
guix-arunisaac-aaa6f158b27a671d7b4537872f3b905ad088b5d6.zip
Add prometheus.
Diffstat (limited to 'arunisaac')
-rw-r--r--arunisaac/prometheus.scm78
1 files changed, 78 insertions, 0 deletions
diff --git a/arunisaac/prometheus.scm b/arunisaac/prometheus.scm
new file mode 100644
index 0000000..fb0aa80
--- /dev/null
+++ b/arunisaac/prometheus.scm
@@ -0,0 +1,78 @@
+;;; guix-arunisaac --- arunisaac's Guix odds and ends
+;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2026 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; 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
+;;; <https://www.gnu.org/licenses/>.
+
+(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)))