diff --git a/modules/rosenthal/utils/file.scm b/modules/rosenthal/utils/file.scm new file mode 100644 index 0000000..e2a7013 --- /dev/null +++ b/modules/rosenthal/utils/file.scm @@ -0,0 +1,22 @@ +;;; SPDX-License-Identifier: GPL-3.0-or-later +;;; Copyright © 2025 Hilton Chain + +(define-module (rosenthal utils file) + #:use-module (ice-9 textual-ports) + #:use-module (guix gexp) + #:export (computed-substitution-with-inputs + file-content)) + +(define (computed-substitution-with-inputs name file inputs) + (with-imported-modules '((guix build utils)) + (computed-file + name + #~(begin + (use-modules (guix build utils)) + (copy-file #$file #$output) + (substitute* #$output + (("\\$\\$([^\\$]+)\\$\\$" _ path) + (search-path '#$inputs path))))))) + +(define (file-content file) + (call-with-input-file (canonicalize-path file) get-string-all)) diff --git a/modules/rosenthal/utils/packages.scm b/modules/rosenthal/utils/packages.scm index 433918b..0589928 100644 --- a/modules/rosenthal/utils/packages.scm +++ b/modules/rosenthal/utils/packages.scm @@ -1,6 +1,7 @@ ;;; SPDX-License-Identifier: GPL-3.0-or-later ;;; Copyright © 2015, 2018 Ludovic Courtès ;;; Copyright © 2025 Maxim Cournoyer +;;; Copyright © 2025 Hilton Chain (define-module (rosenthal utils packages) #:use-module (gnu packages) @@ -17,15 +18,13 @@ #:export (rosenthal-patches %rosenthal-package-module-path all-rosenthal-packages - rosenthal-disable-updater?)) -;;; Commentary: -;;; -;;; This module refines the default value of some parameters from (gnu -;;; packages) and the syntax/procedures using those. This allows -;;; 'search-paths' and friends to work without any user intervention. -;;; -;;; Code: + rosenthal-disable-updater? + delete-package-from-list + pkg + pkg+out + pkgs + pkgs+out)) (define %rosenthal-root-directory ;; This is like %distro-root-directory from (gnu packages), with adjusted @@ -101,5 +100,25 @@ packages, excluding superseded packages." ;; Dismiss deprecated packages but keep hidden packages. #:select? (negate package-superseded)))) + + (define (rosenthal-disable-updater? p) (assq-ref (package-properties p) 'disable-updater?)) + +(define (delete-package-from-list name lst) + "Return a copy of package list LST, removing packages named NAME." + (filter (lambda (pkg) + (not (string=? name (package-name pkg)))) + lst)) + +(define (pkg spec) + (specification->package spec)) + +(define (pkg+out spec) + (specification->package+output spec)) + +(define (pkgs . specs) + (map pkg specs)) + +(define (pkgs+out . specs) + (map pkg+out specs))