guix.yml
1 # SPDX-FileCopyrightText: Stephen Paul Weber <singpolyma@singpolyma.net> 2 # 3 # SPDX-License-Identifier: AGPL-3.0-or-later 4 5 image: guix 6 packages: 7 - plzip 8 sources: 9 - https://git.sr.ht/~amolith/adresilo-server 10 artifacts: 11 - adresilo-server.scm 12 - adresilo-server.nar.lz 13 tasks: 14 - bake: | 15 printf "(define-module (adresilo-server))\n" >> adresilo-server.scm 16 sed '/^;;;;$/q' adresilo-server/guix.scm >> adresilo-server.scm 17 printf "(define-public adresilo-server\n\t" >> adresilo-server.scm 18 cd adresilo-server 19 VERSION=$(git describe --always --dirty) 20 sed -i 's|(read-line (open-pipe\* OPEN_READ "git" "--git-dir" %git-dir "describe" "--always" "--dirty"))|"'"$VERSION"'"|g' guix.scm 21 COMMIT=$(git rev-parse HEAD) 22 sed -i 's|(read-line (open-pipe\* OPEN_READ "git" "--git-dir" %git-dir "rev-parse" "HEAD"))|"'"$COMMIT"'"|g' guix.scm 23 REVCOUNT=$(git rev-list --count HEAD) 24 sed -i 's|(read-line (open-pipe\* OPEN_READ "git" "--git-dir" %git-dir "rev-list" "--count" "HEAD"))|"'"$REVCOUNT"'"|g' guix.scm 25 SHORT_COMMIT=$(git rev-parse --short=7 HEAD) 26 sed -i 's|(read-line (open-pipe\* OPEN_READ "git" "--git-dir" %git-dir "rev-parse" "--short=7" "HEAD"))|"'"$SHORT_COMMIT"'"|g' guix.scm 27 SOURCE_HASH=$(guix hash -rx .) 28 sed -i 's|(read-line (open-pipe\* OPEN_READ "guix" "hash" "-rx" %source-dir))|"'"$SOURCE_HASH"'"|g' guix.scm 29 printf '(load "%s/guix.scm")\n(write adresilo-server-baked)\n' "$(pwd)" | guix repl /dev/stdin >> ../adresilo-server.scm 30 cd - 31 printf ")\n" >> adresilo-server.scm 32 rm -f adresilo-server/guix.scm 33 [ "$BUILD_REASON" = patchset ] || rm -rf adresilo-server 34 - build: | 35 if [ "$BUILD_REASON" = patchset ]; then with_source="--with-source=$PWD/adresilo-server"; fi 36 guix build $with_source --no-grafts -r out -L. adresilo-server 37 - archive: | 38 guix archive --export -r --no-grafts $(readlink -f out) > adresilo-server.nar 39 plzip adresilo-server.nar