@@ 0,0 1,28 @@
+image: guix
+packages:
+- plzip
+sources:
+- https://git.sr.ht/~singpolyma/sgx-aa
+secrets:
+- 9ded4157-4cf9-42ae-b7d0-55eb6e52ea37
+- fd52c9ce-04e8-4684-af6c-1ab78d2e124a
+artifacts:
+- sgx-aa.scm
+- sgx-aa.nar.lz
+tasks:
+- bake: |
+ printf "(define-module (sgx-aa))\n" >> sgx-aa.scm
+ sed '/^;;;;$/q' sgx-aa/guix.scm >> sgx-aa.scm
+ printf "(define-public sgx-aa\n\t" >> sgx-aa.scm
+ cd sgx-aa
+ printf '(load "%s/guix.scm")\n(write sgx-aa-baked)\n' "$(pwd)" | guix repl /dev/stdin >> ../sgx-aa.scm
+ cd -
+ printf ")\n" >> sgx-aa.scm
+ rm -f sgx-aa/guix.scm
+ [ "$BUILD_REASON" = patchset ] || rm -rf sgx-aa
+- build: |
+ if [ "$BUILD_REASON" = patchset ]; then with_source="--with-source=$PWD/sgx-aa"; fi
+ guix build $with_source --no-grafts -r out -L. sgx-aa
+- archive: |
+ guix archive --export -r --no-grafts $(readlink -f out) > sgx-aa.nar
+ plzip sgx-aa.nar
@@ 0,0 1,267 @@
+(use-modules
+ ((guix licenses) #:prefix license:)
+ (guix packages)
+ (guix download)
+ (guix git-download)
+ (guix build-system go)
+ (gnu packages golang)
+ (ice-9 rdelim)
+ (ice-9 popen)
+)
+
+(define-public go-github-com-gorilla-mux
+ (package
+ (name "go-github-com-gorilla-mux")
+ (version "1.8.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/gorilla/mux")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0pfh9bmy7j750ghw268jg90n9cx7vsx6wzv3bda0qqk512y02c4w"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/gorilla/mux"))
+ (home-page "https://github.com/gorilla/mux")
+ (synopsis "gorilla/mux")
+ (description "Package mux implements a request router and dispatcher.")
+ (license license:bsd-3)))
+
+(define-public go-github-com-cespare-xxhash-v2
+ (package
+ (name "go-github-com-cespare-xxhash-v2")
+ (version "2.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cespare/xxhash")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "055xvgyv78xl6bdj8kgy0105n9cq33w4rb0sg84lp9r85i9qx2l5"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/cespare/xxhash/v2"))
+ (home-page "https://github.com/cespare/xxhash")
+ (synopsis "xxhash")
+ (description
+ "Package xxhash implements the 64-bit variant of @code{xxHash} (XXH64) as
+described at
+@code{@@url{http://cyan4973.github.io/xxHash/,http://cyan4973.github.io/xxHash/}.}")
+ (license license:expat)))
+
+(define-public go-github-com-dgryski-go-rendezvous
+ (package
+ (name "go-github-com-dgryski-go-rendezvous")
+ (version "0.0.0-20200823014737-9f7001d12a5f")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dgryski/go-rendezvous")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0hhdbsm5k19kh1fyxs4aibza9jylils4p3555lr8xalhj2iz3zlz"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/dgryski/go-rendezvous"))
+ (home-page "https://github.com/dgryski/go-rendezvous")
+ (synopsis #f)
+ (description #f)
+ (license license:expat)))
+
+(define-public go-github-com-redis-go-redis-v9
+ (package
+ (name "go-github-com-redis-go-redis-v9")
+ (version "9.2.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/redis/go-redis")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0mrfcg50kkh7pfbb3q0758nfgz80bw00ijngd3xry41cdhakfjrs"))))
+ (build-system go-build-system)
+ (arguments
+ `(#:import-path "github.com/redis/go-redis/v9" #:go ,go-1.19 #:tests? #f))
+ (propagated-inputs `(("go-github-com-dgryski-go-rendezvous" ,go-github-com-dgryski-go-rendezvous)
+ ("go-github-com-cespare-xxhash-v2" ,go-github-com-cespare-xxhash-v2)))
+ (home-page "https://github.com/redis/go-redis")
+ (synopsis "Redis client for Go")
+ (description "Package redis implements a Redis client.")
+ (license license:bsd-2)))
+
+(define-public go-mellium-im-sasl
+ (package
+ (name "go-mellium-im-sasl")
+ (version "0.3.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://codeberg.org/mellium/sasl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1qld1kw5j53nj1i0zgr4xbdkqgjcslaiir6s82a52h2izb8mp8ib"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "mellium.im/sasl"))
+ (propagated-inputs `(("go-golang-org-x-crypto" ,go-golang-org-x-crypto)))
+ (home-page "https://mellium.im/sasl")
+ (synopsis "SASL")
+ (description
+ "Package sasl implements the Simple Authentication and Security Layer (SASL) as
+defined by @@url{https://rfc-editor.org/rfc/rfc4422.html,RFC 4422}.")
+ (license license:bsd-2)))
+
+(define-public go-mellium-im-xmlstream
+ (package
+ (name "go-mellium-im-xmlstream")
+ (version "0.15.4")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://codeberg.org/mellium/xmlstream")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "183nqjd34f7hfaahnh7cqh2wrwvjy77dkjm484mcxb935rdrpjm5"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "mellium.im/xmlstream"))
+ (propagated-inputs `(("go-mellium-im-reader" ,go-mellium-im-reader)))
+ (home-page "https://mellium.im/xmlstream")
+ (synopsis "mellium.im/xmlstream")
+ (description
+ "Package xmlstream provides an API for streaming, transforming, and otherwise
+manipulating XML data.")
+ (license license:bsd-2)))
+
+(define-public go-mellium-im-reader
+ (package
+ (name "go-mellium-im-reader")
+ (version "0.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://codeberg.org/mellium/reader")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1drb2ibi6ygg4x824vymj1zw2kj1i6wvdiqw88qlwbgj9jqly2kw"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "mellium.im/reader"))
+ (home-page "https://mellium.im/reader")
+ (synopsis "mellium.im/reader")
+ (description
+ "Package reader contains small, reusable APIs that build on the io.Reader
+interface.")
+ (license license:bsd-2)))
+
+(define-public go-mellium-im-xmpp
+ (package
+ (name "go-mellium-im-xmpp")
+ (version "0.21.4")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://codeberg.org/mellium/xmpp")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "176q3hlidhlcsad54fjwm6fhk2il42r5dhmrlga6glflkdsn50zj"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "mellium.im/xmpp"))
+ (propagated-inputs `(("go-mellium-im-reader" ,go-mellium-im-reader)
+ ("go-golang-org-x-mod" ,go-golang-org-x-mod)
+ ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
+ ("go-mellium-im-xmlstream" ,go-mellium-im-xmlstream)
+ ("go-mellium-im-sasl" ,go-mellium-im-sasl)
+ ("go-golang-org-x-tools" ,go-golang-org-x-tools)
+ ("go-golang-org-x-text" ,go-golang-org-x-text)
+ ("go-golang-org-x-sys" ,go-golang-org-x-sys)
+ ("go-golang-org-x-net" ,go-golang-org-x-net)
+ ("go-golang-org-x-image" ,go-golang-org-x-image)))
+ (home-page "https://mellium.im/xmpp")
+ (synopsis "XMPP")
+ (description
+ "Package xmpp provides functionality from the Extensible Messaging and Presence
+Protocol, sometimes known as \"Jabber\".")
+ (license license:bsd-2)))
+
+;;;;
+
+(define %source-dir (dirname (current-filename)))
+(define %git-dir (string-append %source-dir "/.git"))
+
+; Bake a template by eval'ing the leaves
+(define-public (bake tmpl)
+ (cons
+ (car tmpl)
+ (map
+ (lambda (x) (list (car x) (eval (cadr x) (current-module))))
+ (cdr tmpl))))
+
+; double-escaped template of the sgx-aa sexp
+; This allows us to bake the expression without doing a full eval to a record,
+; so it can be written
+(define-public sgx-aa-template
+ '(package
+ (name "sgx-aa")
+ (version (read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "describe" "--always" "--dirty")))
+ (source `(origin
+ (method git-fetch)
+ (uri (git-reference
+ (recursive? #t)
+ (url "https://git.singpolyma.net/sgx-aa")
+ (commit ,(read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "rev-parse" "HEAD")))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ ,(read-line (open-pipe* OPEN_READ "guix" "hash" "-rx" %source-dir))))))
+ (build-system 'go-build-system)
+ (arguments
+ '`(#:import-path "sgx-aa" #:unpack-path "sgx-aa" #:go ,go-1.19 #:tests? #f #:install-source? #f))
+ (inputs
+ '(list
+ go-github-com-gorilla-mux
+ go-github-com-dgryski-go-rendezvous
+ go-github-com-google-uuid
+ go-github-com-redis-go-redis-v9
+ go-golang-org-x-crypto
+ go-golang-org-x-mod
+ go-golang-org-x-net
+ go-golang-org-x-sys
+ go-golang-org-x-text
+ go-golang-org-x-tools
+ go-mellium-im-reader
+ go-mellium-im-sasl
+ go-mellium-im-xmlstream
+ go-mellium-im-xmpp
+ go-github-com-cespare-xxhash-v2))
+ (home-page "https://certwatch.xmpp.net")
+ (synopsis #f)
+ (description #f)
+ (license 'license:agpl3)))
+
+; Baked version of sgx-aa-template with leaves eval'd
+(define-public sgx-aa-baked
+ (bake sgx-aa-template))
+
+; Build clean from git the version from a local clone
+; To build whatever is sitting in local use:
+; guix build --with-source=$PWD -f guix.scm
+(eval sgx-aa-baked (current-module))