diff options
| author | Hilton Chain <hako@ultrarare.space> | 2025-06-11 21:50:57 +0800 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2025-06-11 22:15:43 +0800 |
| commit | fba2af60c9050c3abdc274521fb1211d39fa9ecd (patch) | |
| tree | d94e00a9ee86592ab9b6304f6af5bae0af07b171 | |
| parent | 1048cbf084d2d8aa3d6a746a2720d7cf3d612b12 (diff) | |
nonguix: Add ‘nonguix-transformation-guix’.
* nonguix/transformations.scm: New file.
| -rw-r--r-- | nonguix/transformations.scm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/nonguix/transformations.scm b/nonguix/transformations.scm new file mode 100644 index 0000000..ea38127 --- /dev/null +++ b/nonguix/transformations.scm | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | ;;; SPDX-License-Identifier: GPL-3.0-or-later | ||
| 2 | ;;; Copyright © 2025 Hilton Chain <hako@ultrarare.space> | ||
| 3 | |||
| 4 | (define-module (nonguix transformations) | ||
| 5 | #:use-module (guix channels) | ||
| 6 | #:use-module (guix diagnostics) | ||
| 7 | #:use-module (guix gexp) | ||
| 8 | #:use-module (guix i18n) | ||
| 9 | #:use-module (guix packages) | ||
| 10 | #:use-module (gnu system) | ||
| 11 | #:use-module (nongnu system linux-initrd) | ||
| 12 | #:use-module (gnu services) | ||
| 13 | #:use-module (gnu services base) | ||
| 14 | #:use-module (nongnu services nvidia) | ||
| 15 | #:use-module (gnu packages package-management) | ||
| 16 | #:use-module (nongnu packages linux) | ||
| 17 | #:use-module (nongnu packages nvidia) | ||
| 18 | #:export (nonguix-transformation-guix)) | ||
| 19 | |||
| 20 | (define* (nonguix-transformation-guix #:key (substitutes? #t) | ||
| 21 | (channel? #t) | ||
| 22 | (guix-source? #f)) | ||
| 23 | "Return a procedure that transforms an operating system, setting up Nonguix | ||
| 24 | signing key for the Guix daemon. | ||
| 25 | |||
| 26 | Additionally, SUBSTITUTES? (default: #t) sets up the substitute server, | ||
| 27 | CHANNEL? (default: #t) adds Nonguix channel specification into | ||
| 28 | '/etc/guix/channels.scm' and GUIX-SOURCE? (default: #f) builds Nonguix channel | ||
| 29 | into the default Guix. | ||
| 30 | |||
| 31 | FIXME: GUIX-SOURCE? is disabled by default due to performance issue." | ||
| 32 | |||
| 33 | (define %nonguix-signing-key | ||
| 34 | (plain-file "nonguix.pub" " | ||
| 35 | (public-key | ||
| 36 | (ecc | ||
| 37 | (curve Ed25519) | ||
| 38 | (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)))")) | ||
| 39 | |||
| 40 | (define %nonguix-channel | ||
| 41 | (channel | ||
| 42 | (name 'nonguix) | ||
| 43 | (url "https://gitlab.com/nonguix/nonguix") | ||
| 44 | ;; Enable signature verification: | ||
| 45 | (introduction | ||
| 46 | (make-channel-introduction | ||
| 47 | "897c1a470da759236cc11798f4e0a5f7d4d59fbc" | ||
| 48 | (openpgp-fingerprint | ||
| 49 | "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))) | ||
| 50 | |||
| 51 | (lambda (os) | ||
| 52 | (operating-system | ||
| 53 | (inherit os) | ||
| 54 | (services | ||
| 55 | (modify-services (operating-system-user-services os) | ||
| 56 | (guix-service-type | ||
| 57 | config => (guix-configuration | ||
| 58 | (inherit config) | ||
| 59 | (channels | ||
| 60 | (let ((configured-channels | ||
| 61 | (guix-configuration-channels config))) | ||
| 62 | (if channel? | ||
| 63 | (cons %nonguix-channel | ||
| 64 | (or configured-channels %default-channels)) | ||
| 65 | configured-channels))) | ||
| 66 | (guix | ||
| 67 | (if guix-source? | ||
| 68 | (guix-for-channels channels) | ||
| 69 | (guix-configuration-guix config))) | ||
| 70 | (authorized-keys | ||
| 71 | (cons %nonguix-signing-key | ||
| 72 | (guix-configuration-authorized-keys config))) | ||
| 73 | (substitute-urls | ||
| 74 | `(,@(guix-configuration-substitute-urls config) | ||
| 75 | ,@(if substitutes? | ||
| 76 | '("https://substitutes.nonguix.org") | ||
| 77 | '())))))))))) | ||
