From fad54003497e6246fde60dfbf30f64f11d5985ea Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Wed, 4 Jun 2025 23:13:11 +0200 Subject: [PATCH] gnu: Add postgresql-backup-scripts. * gnu/packages/databases.scm (postgresql-backup-scripts): New variable. Change-Id: I3e8516e03fa74779aa397c80f4f1860f5c6d5a01 Signed-off-by: Sharlatan Hellseher --- gnu/packages/databases.scm | 63 +++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index f7a6cf926d..59337085fa 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -61,7 +61,7 @@ ;;; Copyright © 2021, 2022 jgart ;;; Copyright © 2023, 2024 Felix Gruber ;;; Copyright © 2023 Munyoki Kilyungi -;;; Copyright © 2023 Giacomo Leidi +;;; Copyright © 2023, 2025 Giacomo Leidi ;;; Copyright © 2024 Troy Figiel ;;; Copyright © 2024 gemmaro ;;; Copyright © 2025 Ashvith Shetty @@ -184,6 +184,7 @@ #:use-module (guix bzr-download) #:use-module (guix git-download) #:use-module (guix hg-download) + #:use-module (guix build-system copy) #:use-module (guix build-system emacs) #:use-module (guix build-system gnu) #:use-module (guix build-system go) @@ -1756,6 +1757,66 @@ Store your vectors with the rest of your data. It supports: CSV, DB3, iXF, SQLite, MS-SQL or MySQL to PostgreSQL.") (license (license:x11-style "file://LICENSE")))) +(define-public postgresql-backup-scripts + (package + (name "postgresql-backup-scripts") + (version "0.0.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url (string-append "https://codeberg.org/fishinthecalculator/" + "postgresql-backup-scripts")) + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0ig19345p9h2z56k07i6g94pls2b4fhxacf1i8f0hxvk2p4x730k")))) + (build-system copy-build-system) + (arguments + (list + #:install-plan #~'(("./src/" "/bin") + ("./examples" "/share/examples")) + #:phases + #~(modify-phases %standard-phases + (add-after 'install 'chmod + (lambda _ + (for-each + (lambda (file) (chmod file #o755)) + (find-files (string-append #$output "/bin"))))) + (add-after 'chmod 'wrap + (lambda _ + (let* ((bin (string-append #$output "/bin")) + (inputs + (list + #$@(map cadr + (package-inputs this-package)))) + (lib-directories (search-path-as-list '("lib") inputs)) + (bin-directories + (search-path-as-list + '("bin" "sbin" "libexec") + inputs))) + (for-each + (lambda (exe) + (wrap-program exe + `("PATH" ":" prefix + (,(string-join bin-directories ":"))) + `("LD_LIBRARY_PATH" ":" prefix + (,(string-join lib-directories ":"))))) + (find-files bin)))))))) + (inputs + (list coreutils + bash-minimal + findutils + postgresql)) + (home-page "https://codeberg.org/fishinthecalculator/postgresql-backup-scripts") + (synopsis "Utility scripts for PostgreSQL backups") + (description + "This package provides two scripts that will backup PostgreSQL databases in +a cluster. They are supposed to be run in scheduled jobs. @code{pg_backup.sh} +runs regular backups, @code{pg_backup_rotated.sh} runs rotated backups.") + (license + (license:x11-style "file://LICENSE")))) + (define-public python-pymysql (package (name "python-pymysql")