Hello, I am new to Guix but it seems to be the perfect tools for running a small cluster of servers that I need to administer. The one thing that so far is holding me back from doing so is the absence of a package for Caddy (https://caddyserver.com) which this cluster relies on heavily. I hope in the future to package it properly, but it has a number of golang dependencies that are not themselves even packaged, and I am far from an expert on building Go software -- it seems doable but it would be a relatively big undertaking. Instead, I thought I could create a private package with copy-build-system and simply install the pre-built binaries that the Caddy project provides. This is the caddy-package.scm that I have come up with: > > (use-modules (guix) > (guix build-system copy) > (guix build utils) > (guix licenses)) > > > (package > (name "caddy") > > (version "2.2.1") > > (source > (origin > (method url-fetch) > (uri (string-append "https://github.com/caddyserver/caddy/releases/download/" version "/caddy_" version "_linux_amd64.tar.gz")) > (sha256 > (base32 > "1va2h8hpxcby9rny7px1y2xks79rxb4svnf9mrdrlc5xn0s04dsx")))) > > (build-system copy-build-system) > > (arguments > '(#:install-plan '(("caddy" "bin/caddy")))) > > (synopsis "This is a *BAD* Caddy package. It just pulls the already-built binary from Github, rather than building from source.") > (description "See https://caddyserver.com/") > (home-page "https://caddyserver.com/") > (license asl2.0)) When I build this file with `guix build -f caddy-package.scm -K', it fails with this rather mysterious (to me) error during the unpack phase: > starting phase `unpack' > LICENSE > README.md > caddy > Backtrace: > 8 (primitive-load "/gnu/store/fa16h805lxm1fmyhdmnwd09cpd7…") > In ice-9/eval.scm: > 191:35 7 (_ #f) > In guix/build/gnu-build-system.scm: > 838:2 6 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #) > In ice-9/boot-9.scm: > 1736:10 5 (with-exception-handler _ _ #:unwind? _ # _) > In srfi/srfi-1.scm: > 857:16 4 (every1 #<procedure 7ffff634c0a0 at guix/build/gnu-bui…> …) > In guix/build/gnu-build-system.scm: > 847:30 3 (_ _) > 164:15 2 (unpack #:source _) > 65:2 1 (first-subdirectory _) > In ice-9/boot-9.scm: > 1669:16 0 (raise-exception _ #:continuable? _) > > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Throw to key `match-error' with args `("match" "no matching pattern" ())'. > note: keeping build directory `/tmp/guix-build-caddy-2.2.1.drv-20' > builder for `/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed with exit code 1 > build of /gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv failed > View build log at '/var/log/guix/drvs/p6/5q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv.bz2'. > guix build: error: build of `/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed Would anyone be able to give me any advice here? This seems to comport with the Reference Manual blurb (https://guix.gnu.org/manual/en/guix.html#index-copy_002dbuild_002dsystem) about copy-build-system and also appears similar to several official packages using copy-build-system (e.g. gcide, vim-neocomplete, neverball) that I looked to as examples. Clearly though, there is some nuance that I am missing. Thanks in advance for any help you can provide. -Cam Tindall
Hello, I am new to Guix but it seems to be the perfect tools for running a small cluster of servers that I need to administer. The one thing that so far is holding me back from doing so is the absence of a package for Caddy (https://caddyserver.com) which this cluster relies on heavily. I hope in the future to package it properly, but it has a number of golang dependencies that are not themselves even packaged, and I am far from an expert on building Go software -- it seems doable but it would be a relatively big undertaking. Instead, I thought I could create a private package with copy-build-system and simply install the pre-built binaries that the Caddy project provides. This is the caddy-package.scm that I have come up with: > > (use-modules (guix) > (guix build-system copy) > (guix build utils) > (guix licenses)) > > > (package > (name "caddy") > > (version "2.2.1") > > (source > (origin > (method url-fetch) > (uri (string-append "https://github.com/caddyserver/caddy/releases/download/" version "/caddy_" version "_linux_amd64.tar.gz")) > (sha256 > (base32 > "1va2h8hpxcby9rny7px1y2xks79rxb4svnf9mrdrlc5xn0s04dsx")))) > > (build-system copy-build-system) > > (arguments > '(#:install-plan '(("caddy" "bin/caddy")))) > > (synopsis "This is a *BAD* Caddy package. It just pulls the already-built binary from Github, rather than building from source.") > (description "See https://caddyserver.com/") > (home-page "https://caddyserver.com/") > (license asl2.0)) When I build this file with `guix build -f caddy-package.scm -K', it fails with this rather mysterious (to me) error during the unpack phase: > starting phase `unpack' > LICENSE > README.md > caddy > Backtrace: > 8 (primitive-load "/gnu/store/fa16h805lxm1fmyhdmnwd09cpd7…") > In ice-9/eval.scm: > 191:35 7 (_ #f) > In guix/build/gnu-build-system.scm: > 838:2 6 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #) > In ice-9/boot-9.scm: > 1736:10 5 (with-exception-handler _ _ #:unwind? _ # _) > In srfi/srfi-1.scm: > 857:16 4 (every1 #<procedure 7ffff634c0a0 at guix/build/gnu-bui…> …) > In guix/build/gnu-build-system.scm: > 847:30 3 (_ _) > 164:15 2 (unpack #:source _) > 65:2 1 (first-subdirectory _) > In ice-9/boot-9.scm: > 1669:16 0 (raise-exception _ #:continuable? _) > > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Throw to key `match-error' with args `("match" "no matching pattern" ())'. > note: keeping build directory `/tmp/guix-build-caddy-2.2.1.drv-20' > builder for `/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed with exit code 1 > build of /gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv failed > View build log at '/var/log/guix/drvs/p6/5q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv.bz2'. > guix build: error: build of `/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed Would anyone be able to give me any advice here? This seems to comport with the Reference Manual blurb (https://guix.gnu.org/manual/en/guix.html#index-copy_002dbuild_002dsystem) about copy-build-system and also appears similar to several official packages using copy-build-system (e.g. gcide, vim-neocomplete, neverball) that I looked to as examples. Clearly though, there is some nuance that I am missing. Thanks in advance for any help you can provide. -Cam Tindall
I don't think this is related to the copy-build-system, because it doesn't change the unpack phase. Whathappens here is that guix expects the content of the tarball to be in a subdirectory, which is not the case here. In the source definition, you should use url-fetch/tarbomb instead of url-fetch.
Le 23 décembre 2020 18:23:11 GMT-05:00, Cameron <cam@tindall.space> a écrit :
>Hello,
>
>I am new to Guix but it seems to be the perfect tools for running a
>small cluster of servers that I need to administer. The one thing that
>so far is holding me back from doing so is the absence of a package for
>Caddy (https://caddyserver.com) which this cluster relies on heavily. I
>hope in the future to package it properly, but it has a number of
>golang dependencies that are not themselves even packaged, and I am far
>from an expert on building Go software -- it seems doable but it would
>be a relatively big undertaking.
>
>Instead, I thought I could create a private package with
>copy-build-system and simply install the pre-built binaries that the
>Caddy project provides. This is the caddy-package.scm that I have come
>up with:
>>
>> (use-modules (guix)
>> (guix build-system copy)
>> (guix build utils)
>> (guix licenses))
>>
>>
>> (package
>> (name "caddy")
>>
>> (version "2.2.1")
>>
>> (source
>> (origin
>> (method url-fetch)
>> (uri (string-append
>"https://github.com/caddyserver/caddy/releases/download/" version
>"/caddy_" version "_linux_amd64.tar.gz"))
>> (sha256
>> (base32
>> "1va2h8hpxcby9rny7px1y2xks79rxb4svnf9mrdrlc5xn0s04dsx"))))
>>
>> (build-system copy-build-system)
>>
>> (arguments
>> '(#:install-plan '(("caddy" "bin/caddy"))))
>>
>> (synopsis "This is a *BAD* Caddy package. It just pulls the
>already-built binary from Github, rather than building from source.")
>> (description "See https://caddyserver.com/")
>> (home-page "https://caddyserver.com/")
>> (license asl2.0))
>
>When I build this file with `guix build -f caddy-package.scm -K', it
>fails with this rather mysterious (to me) error during the unpack
>phase:
>
>> starting phase `unpack'
>> LICENSE
>> README.md
>> caddy
>> Backtrace:
>> 8 (primitive-load
>"/gnu/store/fa16h805lxm1fmyhdmnwd09cpd7…")
>> In ice-9/eval.scm:
>> 191:35 7 (_ #f)
>> In guix/build/gnu-build-system.scm:
>> 838:2 6 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases .
>#)
>> In ice-9/boot-9.scm:
>> 1736:10 5 (with-exception-handler _ _ #:unwind? _ # _)
>> In srfi/srfi-1.scm:
>> 857:16 4 (every1 #<procedure 7ffff634c0a0 at guix/build/gnu-bui…>
>…)
>> In guix/build/gnu-build-system.scm:
>> 847:30 3 (_ _)
>> 164:15 2 (unpack #:source _)
>> 65:2 1 (first-subdirectory _)
>> In ice-9/boot-9.scm:
>> 1669:16 0 (raise-exception _ #:continuable? _)
>>
>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>> Throw to key `match-error' with args `("match" "no matching pattern"
>())'.
>> note: keeping build directory `/tmp/guix-build-caddy-2.2.1.drv-20'
>> builder for
>`/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed
>with exit code 1
>> build of /gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv
>failed
>> View build log at
>'/var/log/guix/drvs/p6/5q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv.bz2'.
>> guix build: error: build of
>`/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed
>
>Would anyone be able to give me any advice here? This seems to comport
>with the Reference Manual blurb
>(https://guix.gnu.org/manual/en/guix.html#index-copy_002dbuild_002dsystem)
>about copy-build-system and also appears similar to several official
>packages using copy-build-system (e.g. gcide, vim-neocomplete,
>neverball) that I looked to as examples. Clearly though, there is some
>nuance that I am missing.
>
>Thanks in advance for any help you can provide.
>
>-Cam Tindall
Thank you Julien, This was indeed the problem!
Many apologies to everyone for the double-post as well.
-Cam
On Thu, Dec 24, 2020, at 6:07 AM, Julien Lepiller wrote:
> I don't think this is related to the copy-build-system, because it doesn't change the unpack phase. Whathappens here is that guix expects the content of the tarball to be in a subdirectory, which is not the case here. In the source definition, you should use url-fetch/tarbomb instead of url-fetch.
>
> Le 23 décembre 2020 18:23:11 GMT-05:00, Cameron <cam@tindall.space> a écrit :
>> Hello,
>>
>> I am new to Guix but it seems to be the perfect tools for running a small cluster of servers that I need to administer. The one thing that so far is holding me back from doing so is the absence of a package for Caddy (https://caddyserver.com) which this cluster relies on heavily. I hope in the future to package it properly, but it has a number of golang dependencies that are not themselves even packaged, and I am far from an expert on building Go software -- it seems doable but it would be a relatively big undertaking.
>>
>> Instead, I thought I could create a private package with copy-build-system and simply install the pre-built binaries that the Caddy project provides. This is the caddy-package.scm that I have come up with:
>>>
>>> (use-modules (guix)
>>> (guix build-system copy)
>>> (guix build utils)
>>> (guix licenses))
>>>
>>>
>>> (package
>>> (name "caddy")
>>>
>>> (version "2.2.1")
>>>
>>> (source
>>> (origin
>>> (method url-fetch)
>>> (uri (string-append "https://github.com/caddyserver/caddy/releases/download/" version "/caddy_" version "_linux_amd64.tar.gz"))
>>> (sha256
>>> (base32
>>> "1va2h8hpxcby9rny7px1y2xks79rxb4svnf9mrdrlc5xn0s04dsx"))))
>>>
>>> (build-system copy-build-system)
>>>
>>> (arguments
>>> '(#:install-plan '(("caddy" "bin/caddy"))))
>>>
>>> (synopsis "This is a *BAD* Caddy package. It just pulls the already-built binary from Github, rather than building from source.")
>>> (description "See https://caddyserver.com/")
>>> (home-page "https://caddyserver.com/")
>>> (license asl2.0))
>>
>> When I build this file with `guix build -f caddy-package.scm -K', it fails with this rather mysterious (to me) error during the unpack phase:
>>
>>> starting phase `unpack'
>>> LICENSE
>>> README.md
>>> caddy
>>> Backtrace:
>>> 8 (primitive-load "/gnu/store/fa16h805lxm1fmyhdmnwd09cpd7…")
>>> In ice-9/eval.scm:
>>> 191:35 7 (_ #f)
>>> In guix/build/gnu-build-system.scm:
>>> 838:2 6 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
>>> In ice-9/boot-9.scm:
>>> 1736:10 5 (with-exception-handler _ _ #:unwind? _ # _)
>>> In srfi/srfi-1.scm:
>>> 857:16 4 (every1 #<procedure 7ffff634c0a0 at guix/build/gnu-bui…> …)
>>> In guix/build/gnu-build-system.scm:
>>> 847:30 3 (_ _)
>>> 164:15 2 (unpack #:source _)
>>> 65:2 1 (first-subdirectory _)
>>> In ice-9/boot-9.scm:
>>> 1669:16 0 (raise-exception _ #:continuable? _)
>>>
>>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>>> Throw to key `match-error' with args `("match" "no matching pattern" ())'.
>>> note: keeping build directory `/tmp/guix-build-caddy-2.2.1.drv-20'
>>> builder for `/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed with exit code 1
>>> build of /gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv failed
>>> View build log at '/var/log/guix/drvs/p6/5q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv.bz2'.
>>> guix build: error: build of `/gnu/store/p65q2ndw8hcpiq2x62jb9mxv6xa88kkn-caddy-2.2.1.drv' failed
>>
>> Would anyone be able to give me any advice here? This seems to comport with the Reference Manual blurb (https://guix.gnu.org/manual/en/guix.html#index-copy_002dbuild_002dsystem) about copy-build-system and also appears similar to several official packages using copy-build-system (e.g. gcide, vim-neocomplete, neverball) that I looked to as examples. Clearly though, there is some nuance that I am missing.
>>
>> Thanks in advance for any help you can provide.
>>
>> -Cam Tindall
[-- Attachment #1.1.1: Type: text/plain, Size: 260 bytes --] Hello Guix! With the attached patch (top be applied on top-off current master), how to make copy-build-system to install files as `/bin/foofile` instead of `/bin/foodir/foofile`? (The foofiles are selected via #:include) Thank you! Regards, RG. [-- Attachment #1.1.2: qtsol.diff --] [-- Type: text/x-patch, Size: 5149 bytes --] diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm index d921aa87fe..8409fc1803 100644 --- a/gnu/packages/qt.scm +++ b/gnu/packages/qt.scm @@ -2497,18 +2497,18 @@ securely. It will not store any data unencrypted unless explicitly requested.") (with-directory-excursion "qtsingleapplication/src" (for-each delete-file (find-files "." "qtlockedfile.*\\.(h|cpp)")) - (substitute* "qtsingleapplication.pri" - ;; Add include path of LockedFile. - (("INCLUDEPATH \\+=") - "INCLUDEPATH += ../../qtlockedfile/src") - ;; Link library of LockedFile. - (("LIBS \\+=") - "LIBS += -lQtSolutions_LockedFile")) - (substitute* '("qtlocalpeer.h" "qtlocalpeer.cpp") - (("#include \"qtlockedfile.*\\.cpp\"") "") - ;; Unwrap namespace added in the vendoring process. - (("QtLP_Private::QtLockedFile") - "QtLockedFile"))) + (substitute* "qtsingleapplication.pri" + ;; Add include path of LockedFile. + (("INCLUDEPATH \\+=") + "INCLUDEPATH += ../../qtlockedfile/src") + ;; Link library of LockedFile. + (("LIBS \\+=") + "LIBS += -lQtSolutions_LockedFile")) + (substitute* '("qtlocalpeer.h" "qtlocalpeer.cpp") + (("#include \"qtlockedfile.*\\.cpp\"") "") + ;; Unwrap namespace added in the vendoring process. + (("QtLP_Private::QtLockedFile") + "QtLockedFile"))) #t)))) (build-system gnu-build-system) (arguments @@ -2524,16 +2524,32 @@ securely. It will not store any data unencrypted unless explicitly requested.") (modify-phases %standard-phases (add-after 'unpack 'patch-source (lambda* (#:key outputs #:allow-other-keys) + ;; Rename example to examples, in qtlockedfile, + ;; so that it gets picked up during install phase. + (with-directory-excursion "qtlockedfile" + (rename-file "example" "examples") + (rename-file "examples/example.pro" "examples/examples.pro") + (substitute* "qtlockedfile.pro" + (("SUBDIRS\\+=example") "SUBDIRS+=examples"))) (substitute* (find-files "." "common.pri") + ;; Patch run-path for binaries. + (("QMAKE_RPATHDIR \\+= \\$\\$?.*_LIBDIR") + (string-append "QMAKE_RPATHDIR += " + (assoc-ref outputs "out") "/lib")) ;; Remove unnecessary prefixes/suffixes in library names. (("qt5") "qt") (("-head") "")) - ;; Disable building of examples. - (substitute* (find-files "." "\\.pro$") + ;; Disable building of examples for QtSingleApplication. + (substitute* "qtsingleapplication/qtsingleapplication.pro" (("SUBDIRS\\+=examples") "")) - ;; Fix deprecated functions. - (substitute* "qtsoap/src/qtsoap.cpp" - (("toAscii") "toUtf8")) + (with-directory-excursion "qtsoap/src" + ;; Patch Qt imports for QtSoap. + (substitute* "qtsoap.pri" + (("QT \\+= xml network") + "QT += core gui widgets xml network")) + ;; Fix deprecated functions. + (substitute* "qtsoap.cpp" + (("toAscii") "toUtf8"))) #t)) (replace 'configure (lambda _ @@ -2560,7 +2576,17 @@ securely. It will not store any data unencrypted unless explicitly requested.") (assoc-ref copy:%standard-phases 'install) #:install-plan '(("src" "include" #:include-regexp ("\\.h$")) - ("lib" "lib")) + ("lib" "lib") + ("examples" "bin" + #:include ("examples" "canvas_typed" + "canvas_variant" "decoration" + "demo" "extension" + "object_controller" "simple" + "controller" "interactive" + "httpservice" "console" + "loader" "trivial" + "easter" "google" + "population"))) args))) '("qtlockedfile" "qtpropertybrowser" "qtservice" "qtsingleapplication" "qtsoap"))))))) [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --]
[-- Attachment #1: Type: text/plain, Size: 455 bytes --] Hi, I haven't looked closely at your patch, but here is the rule for copy-build-system if I'm not mistaken: the files matching #:include preserve the path relative to the first argument. For instance with this rule ("/source/aaa/" "/target/bbb/" #:include ("foo")) the file /source/aaa/parent/foo is copied to /target/bbb/parent/foo (I haven't tested.) Does that help? -- Pierre Neidhardt https://ambrevar.xyz/ [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 511 bytes --]
[-- Attachment #1.1: Type: text/plain, Size: 570 bytes --] Hi Pierre! > I haven't looked closely at your patch, but here is the rule for > copy-build-system if I'm not mistaken: the files matching #:include > preserve the path relative to the first argument. > > For instance with this rule > > ("/source/aaa/" "/target/bbb/" #:include ("foo")) > > the file > > /source/aaa/parent/foo > > is copied to > > /target/bbb/parent/foo > > (I haven't tested.) > > Does that help? With the same example, I was looking for a way where foo gets copied to as /target/bbb/foo. Regards, RG. [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --]
[-- Attachment #1: Type: text/plain, Size: 295 bytes --] Hi Raghav, Raghav Gururajan <rg@raghavgururajan.name> writes: > With the same example, I was looking for a way where foo gets copied to > as /target/bbb/foo. ("/source/aaa/parent" "/target/bbb/" #:include ("foo")) should work then. -- Pierre Neidhardt https://ambrevar.xyz/ [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 511 bytes --]
[-- Attachment #1.1: Type: text/plain, Size: 428 bytes --] Hi Pierre! >> With the same example, I was looking for a way where foo gets copied to >> as /target/bbb/foo. > > ("/source/aaa/parent" "/target/bbb/" #:include ("foo")) > > should work then. Thanks! Will that work with multiple files. Lets say I do #:include ("foo" "bar"). foo is in /source/aaa/foo and bar is in /source/aaa/parent/bar. I want both of them to be copied to as /target/bbb/. Regards, RG. [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --]
[-- Attachment #1: Type: text/plain, Size: 74 bytes --] You need 2 entries then. -- Pierre Neidhardt https://ambrevar.xyz/ [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 511 bytes --]
[-- Attachment #1.1: Type: text/plain, Size: 58 bytes --] > You need 2 entries then. Cool! Regards, RG. [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --]