projects/guix·blob python-team · refs

51 lines · 1.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2022 Reily Siegel <[email protected]>
3;;; Copyright © 2024 Nicolas Graves <[email protected]>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu home services guix)
21 #:use-module (gnu home services)
22 #:use-module (guix channels)
23 #:use-module (guix gexp)
24 #:use-module (ice-9 pretty-print)
25 #:use-module (srfi srfi-1)
26 #:export (home-channels-service-type))
27
28(define (extend-channel-list initial new)
29 (delete-duplicates
30 (append initial new)
31 (lambda (channel1 channel2)
32 (eq? (channel-name channel1) (channel-name channel2)))))
33
34(define (channels-xdg-files channels)
35 `(("guix/channels.scm"
36 ,(plain-file
37 "channels.scm"
38 (call-with-output-string
39 (lambda (port)
40 (pretty-print (cons 'list (map channel->code channels)) port)))))))
41
42(define home-channels-service-type
43 (service-type
44 (name 'home-channels)
45 (default-value %default-channels)
46 (compose concatenate)
47 (extend extend-channel-list)
48 (extensions
49 (list (service-extension home-xdg-configuration-files-service-type
50 channels-xdg-files)))
51 (description "Manages the per-user Guix channels specification.")))