[PATCH] gnu: Add nar-herder.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Christopher Baines
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal

Debbugs page

Christopher Baines wrote 3 years ago
(address . guix-patches@gnu.org)
20211221102711.30382-1-mail@cbaines.net
* gnu/packages/package-management.scm (nar-herder): New variable.
---
gnu/packages/package-management.scm | 109 ++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)

Toggle diff (122 lines)
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 12736c6caf..feb56f2a9b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -1441,6 +1441,115 @@ (define-public guix-jupyter
in an isolated environment, in separate namespaces.")
(license license:gpl3+)))
+(define-public nar-herder
+ (let ((commit "049dfec287fa948cac6682d0a047bc0ed356f0bf")
+ (revision "1"))
+ (package
+ (name "nar-herder")
+ (version (git-version "0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://git.cbaines.net/git/guix/nar-herder")
+ (commit commit)))
+ (sha256
+ (base32
+ "1bkn6avcyp2rcrqaync65b8yn9dvxlkjpk3mdk5nsy527dzhs5ws"))
+ (file-name (string-append name "-" version "-checkout"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:modules (((guix build guile-build-system)
+ #:select (target-guile-effective-version))
+ ,@%gnu-build-system-modules)
+ #:imported-modules ((guix build guile-build-system)
+ ,@%gnu-build-system-modules)
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'set-GUILE_AUTO_COMPILE
+ (lambda _
+ ;; To avoid warnings relating to 'guild'.
+ (setenv "GUILE_AUTO_COMPILE" "0")
+ #t))
+ (add-after 'install 'wrap-executable
+ (lambda* (#:key inputs outputs target #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (guile (assoc-ref inputs "guile"))
+ (version (target-guile-effective-version))
+ (scm (string-append out "/share/guile/site/" version))
+ (go (string-append out "/lib/guile/" version "/site-ccache")))
+ (for-each
+ (lambda (file)
+ (simple-format (current-error-port) "wrapping: ~A\n" file)
+ (let ((guile-inputs (list
+ "guile-json"
+ "guile-gcrypt"
+ "guix"
+ "guile-lib"
+ "guile-sqlite3"
+ "gnutls"
+ "guile-fibers")))
+ (wrap-program file
+ `("GUILE_LOAD_PATH" ":" prefix
+ (,scm ,(string-join
+ (map (lambda (input)
+ (simple-format
+ #f "~A/share/guile/site/~A"
+ (assoc-ref inputs input)
+ version))
+ guile-inputs)
+ ":")))
+ `("GUILE_LOAD_COMPILED_PATH" ":" prefix
+ (,go ,(string-join
+ (map (lambda (input)
+ (simple-format
+ #f "~A/lib/guile/~A/site-ccache"
+ (assoc-ref inputs input)
+ version))
+ guile-inputs)
+ ":"))))))
+ (find-files bin)))
+ #t))
+ (delete 'strip)))) ; As the .go files aren't compatible
+ (native-inputs
+ (list pkg-config
+ autoconf
+ automake
+ gnutls
+
+ ;; Guile libraries are needed here for cross-compilation.
+ guile-3.0
+ guile-json-4
+ guile-gcrypt
+ guix
+ guile-fibers
+ guile-lib
+ guile-sqlite3))
+ (inputs
+ (list bash-minimal
+ guile-3.0))
+ (propagated-inputs
+ (list guile-json-4
+ guile-gcrypt
+ guix
+ guile-fibers
+ guile-lib
+ guile-sqlite3
+ gnutls))
+ (home-page "https://git.cbaines.net/guix/nar-herder")
+ (synopsis "Utility for managing and serving nars")
+ (description
+ "The Nar Herder is a utility for managing a collection of
+nars (normalized archives, in the context of Guix) along with the
+corresponding narinfo files which contain some signed metadata.
+
+It can assist in serving a collection of nars, moving them between machines,
+or mirroring an existing collection of nars.
+
+It's currently a working prototype, many designed features aren't implemented,
+and the error handling is very rough.")
+ (license license:gpl3+))))
+
(define-public gcab
(package
(name "gcab")
--
2.33.1
Ludovic Courtès wrote 3 years ago
(name . Christopher Baines)(address . mail@cbaines.net)(address . 52699@debbugs.gnu.org)
87pmpq6x0n.fsf@gnu.org
Hello!

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (2 lines)
> * gnu/packages/package-management.scm (nar-herder): New variable.

[...]

Toggle quote (6 lines)
> + (add-before 'build 'set-GUILE_AUTO_COMPILE
> + (lambda _
> + ;; To avoid warnings relating to 'guild'.
> + (setenv "GUILE_AUTO_COMPILE" "0")
> + #t))

You can omit trailing #t’s.

Toggle quote (39 lines)
> + (add-after 'install 'wrap-executable
> + (lambda* (#:key inputs outputs target #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (bin (string-append out "/bin"))
> + (guile (assoc-ref inputs "guile"))
> + (version (target-guile-effective-version))
> + (scm (string-append out "/share/guile/site/" version))
> + (go (string-append out "/lib/guile/" version "/site-ccache")))
> + (for-each
> + (lambda (file)
> + (simple-format (current-error-port) "wrapping: ~A\n" file)
> + (let ((guile-inputs (list
> + "guile-json"
> + "guile-gcrypt"
> + "guix"
> + "guile-lib"
> + "guile-sqlite3"
> + "gnutls"
> + "guile-fibers")))
> + (wrap-program file
> + `("GUILE_LOAD_PATH" ":" prefix
> + (,scm ,(string-join
> + (map (lambda (input)
> + (simple-format
> + #f "~A/share/guile/site/~A"
> + (assoc-ref inputs input)
> + version))
> + guile-inputs)
> + ":")))
> + `("GUILE_LOAD_COMPILED_PATH" ":" prefix
> + (,go ,(string-join
> + (map (lambda (input)
> + (simple-format
> + #f "~A/lib/guile/~A/site-ccache"
> + (assoc-ref inputs input)
> + version))
> + guile-inputs)
> + ":"))))))

I’d use ‘string-append’ rather than ‘format’.

(It’d be nice to have a streamlined solution to wrap those Guile
executables…)

Toggle quote (2 lines)
> + (license license:gpl3+))))

I believe it’s ‘agpl3+’ (though GPLv3+ would make it easier to share
code with Guix; something worth considering).

Otherwise LGTM, thanks!

Ludo’.
Christopher Baines wrote 3 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 52699-done@debbugs.gnu.org)
875yrii4jy.fsf@cbaines.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (67 lines)
> Hello!
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> * gnu/packages/package-management.scm (nar-herder): New variable.
>
> [...]
>
>> + (add-before 'build 'set-GUILE_AUTO_COMPILE
>> + (lambda _
>> + ;; To avoid warnings relating to 'guild'.
>> + (setenv "GUILE_AUTO_COMPILE" "0")
>> + #t))
>
> You can omit trailing #t’s.
>
>> + (add-after 'install 'wrap-executable
>> + (lambda* (#:key inputs outputs target #:allow-other-keys)
>> + (let* ((out (assoc-ref outputs "out"))
>> + (bin (string-append out "/bin"))
>> + (guile (assoc-ref inputs "guile"))
>> + (version (target-guile-effective-version))
>> + (scm (string-append out "/share/guile/site/" version))
>> + (go (string-append out "/lib/guile/" version "/site-ccache")))
>> + (for-each
>> + (lambda (file)
>> + (simple-format (current-error-port) "wrapping: ~A\n" file)
>> + (let ((guile-inputs (list
>> + "guile-json"
>> + "guile-gcrypt"
>> + "guix"
>> + "guile-lib"
>> + "guile-sqlite3"
>> + "gnutls"
>> + "guile-fibers")))
>> + (wrap-program file
>> + `("GUILE_LOAD_PATH" ":" prefix
>> + (,scm ,(string-join
>> + (map (lambda (input)
>> + (simple-format
>> + #f "~A/share/guile/site/~A"
>> + (assoc-ref inputs input)
>> + version))
>> + guile-inputs)
>> + ":")))
>> + `("GUILE_LOAD_COMPILED_PATH" ":" prefix
>> + (,go ,(string-join
>> + (map (lambda (input)
>> + (simple-format
>> + #f "~A/lib/guile/~A/site-ccache"
>> + (assoc-ref inputs input)
>> + version))
>> + guile-inputs)
>> + ":"))))))
>
> I’d use ‘string-append’ rather than ‘format’.
>
> (It’d be nice to have a streamlined solution to wrap those Guile
> executables…)
>
>> + (license license:gpl3+))))
>
> I believe it’s ‘agpl3+’ (though GPLv3+ would make it easier to share
> code with Guix; something worth considering).
>
> Otherwise LGTM, thanks!

Thanks for taking a look! I've pushed as
6f76678cb7575072395198c343a9fecc52839513 with the changes you mentioned
above.

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmHBuXFfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfMbxAAlXR6KswJNksbBlyOU2D73l16gR++jOjp
ri3Aej8AhnSdJEItOhiYehWjAauA31Id+PtdiVAyXDpA7TMrWh4GqWIJZzm5ZBHA
/I4pFw2JCw7vvcGyCHnrw3rKuhkN6T9ETsxazh6qTESTZpqnaAYAVBnKdSCWtzdv
35PITd0s7Nywp8+fBvGmD++rshUDnu+EeljvyhcGP79yqaoulesyUYmgQuQxI7Nb
4d+H+xC5svFLN1D9/JraSFFbh7w7ZtfkMCrwShn3CuUEMJJIESNjExsJxu3iUhz7
7Envb32cCv9SOJok4k5V4dqchua0ZiED5u8O2Fo0xx17x5bjSGVdhKGxp2UDzDi8
swKIW2aLNZsVoPlALrA1U8KmXXIfhd2ZNiqDn/PXp0RS9sz7Az1WQjNOWqKM3Hqn
K+sBuNYaEtOf9LscYZrimu3HQqE0Jpicj+uunkWZHue4XQpVeXVPZKURPNr5YOZz
9RBuruEeJ6NP8yHKaPY9u+DxKWwpBei+8ZUTNqx76ya8jMNWFijp4WiDs9rpsWZ3
msX1LjVdBMQOlaPplvTpu041JmNX69Ri47/FOcXRAQC/5cKBpYr7/5io3//akHuG
5fc6THcwzskGHhvIxKrsP0w1YEcFk8xaNpT9Qj+IuuoboCSCLSa96n/fs40CMoYL
W4eIFkS5cQk=
=KL2n
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 52699@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 52699
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help