|
1 | 1 | (define-module (cs6120 packages) |
2 | 2 | #:use-module (cs6120 channels) |
3 | 3 | #:use-module (gnu packages) |
| 4 | + #:use-module (gnu packages base) |
4 | 5 | #:use-module (gnu packages package-management) |
5 | 6 | #:use-module (gnu packages guile) |
6 | 7 | #:use-module (gnu packages gcc) |
|
12 | 13 | #:use-module (guix git-download) |
13 | 14 | #:use-module (guix channels) |
14 | 15 | #:use-module (guix build-system channel) |
| 16 | + #:use-module (guix build-system guile) |
15 | 17 | #:use-module ((guix licenses) #:prefix license:) |
16 | 18 | #:use-module (srfi srfi-1) |
17 | 19 | #:use-module (nonguix build-system binary) |
|
48 | 50 | (inputs (modify-inputs (package-inputs guix) |
49 | 51 | (replace "guile" guile-next)))))) |
50 | 52 |
|
51 | | -(define-public (guix-for-channels channels) |
52 | | - "Return a package corresponding to CHANNELS." |
| 53 | +(define (channel->git-checkout channel) |
| 54 | + (git-checkout |
| 55 | + (url (channel-url channel)) |
| 56 | + (commit (channel-commit channel)))) |
| 57 | + |
| 58 | +(define* (channels-union name channels |
| 59 | + #:key |
| 60 | + (quiet? #f) |
| 61 | + (resolve-collision 'resolve-collision/default)) |
| 62 | + "Return a directory that is the union of CHANNELS sources." |
| 63 | + (define log-port |
| 64 | + (if quiet? |
| 65 | + (gexp (%make-void-port "w")) |
| 66 | + (gexp (current-error-port)))) |
| 67 | + |
| 68 | + (computed-file |
| 69 | + name |
| 70 | + (with-imported-modules '((guix build union)) |
| 71 | + (gexp |
| 72 | + (begin |
| 73 | + (use-modules (guix build union) |
| 74 | + (srfi srfi-1)) ;for 'first' and 'last' |
| 75 | + |
| 76 | + (define (thing->srcs thing) |
| 77 | + (with-input-from-file (string-append thing "/.guix-channel") |
| 78 | + (lambda () |
| 79 | + (let ((dirs (assoc-ref (cdr (read)) 'directory))) |
| 80 | + (if dirs |
| 81 | + (map (lambda (x) (string-append thing "/" x)) dirs) |
| 82 | + (list thing)))))) |
| 83 | + |
| 84 | + (union-build (ungexp output) |
| 85 | + (append-map thing->srcs '#$channels) |
| 86 | + |
| 87 | + #:log-port (ungexp log-port) |
| 88 | + #:symlink symlink |
| 89 | + #:resolve-collision |
| 90 | + (ungexp resolve-collision))))))) |
| 91 | + |
| 92 | +(define (channels->combined-source-code channels) |
| 93 | + (channels-union |
| 94 | + "channels-sources" |
| 95 | + (map channel->git-checkout channels))) |
| 96 | + |
| 97 | +(define-public (package-for-channels channels) |
53 | 98 | (package |
54 | | - (inherit guix-from-core-channels) |
55 | | - (source (find guix-channel? channels)) |
56 | | - (build-system channel-build-system) |
57 | | - (arguments |
58 | | - `(#:channels ,(remove guix-channel? channels))) |
59 | | - (inputs '()) |
60 | | - (native-inputs '()) |
61 | | - (propagated-inputs '()))) |
| 99 | + (name "channels") |
| 100 | + (version "0.1.0") |
| 101 | + (source (channels->combined-source-code |
| 102 | + (remove guix-channel? channels))) |
| 103 | + (build-system guile-build-system) |
| 104 | + (arguments |
| 105 | + (list |
| 106 | + #:source-directory "." |
| 107 | + #:phases |
| 108 | + #~(modify-phases %standard-phases |
| 109 | + (replace 'unpack |
| 110 | + (lambda* (#:key source #:allow-other-keys) |
| 111 | + (mkdir "source") |
| 112 | + (chdir "source") |
| 113 | + (copy-recursively source "." |
| 114 | + #:keep-mtime? #t |
| 115 | + #:follow-symlinks? #t) |
| 116 | + (for-each (lambda (f) |
| 117 | + (false-if-exception (make-file-writable f))) |
| 118 | + (find-files "."))))))) |
| 119 | + (inputs `(("guile" ,guile-next) |
| 120 | + ("guix" ,guix-from-core-channels))) |
| 121 | + (home-page "https://git.sr.ht/~abcdw/rde") |
| 122 | + (synopsis "Combined package for channel source and bytecode files") |
| 123 | + (description "Combined package for channel source and bytecode files.") |
| 124 | + (license license:gpl3+))) |
62 | 125 |
|
63 | 126 | (define-public core-channels-package |
64 | | - (guix-for-channels core-channels)) |
| 127 | + (package-for-channels core-channels)) |
| 128 | + |
| 129 | +;; ((@ (rde api store) build-with-store) core-channels-package) |
| 130 | + |
65 | 131 |
|
66 | 132 | (define-public deno |
67 | 133 | (package |
|
0 commit comments