image: guix
packages:
- plzip
sources:
- https://git.sr.ht/~singpolyma/jmp-pay
secrets:
- 9ded4157-4cf9-42ae-b7d0-55eb6e52ea37
- fd52c9ce-04e8-4684-af6c-1ab78d2e124a
artifacts:
- jmp-pay.scm
- jmp-pay.nar.lz
tasks:
- bake: |
    printf "(define-module (jmp-pay))\n" > jmp-pay.scm
    sed '/^;;;;$/q' jmp-pay/guix.scm >> jmp-pay.scm
    printf "(define-public jmp-pay\n\t" >> jmp-pay.scm
    cd jmp-pay
    printf '(load "%s/guix.scm")\n(write jmp-pay-baked)\n' "$(pwd)" | guix repl /dev/stdin >> ../jmp-pay.scm
    cd -
    printf ")\n" >> jmp-pay.scm
    rm -f jmp-pay/guix.scm
    [ "$BUILD_REASON" = patchset ] || rm -rf jmp-pay
- build: |
    if [ "$BUILD_REASON" = patchset ]; then with_source="--with-source=$PWD/jmp-pay"; fi
    guix build $with_source --no-grafts -r out -L. jmp-pay
- archive: |
    if [ -e signing-key.sec ]; then
      sudo mv signing-key.pub /etc/guix/
      sudo mv signing-key.sec /etc/guix/
      sudo chown root:root /etc/guix/signing-key.sec
      sudo chmod 0400 /etc/guix/signing-key.sec
    fi
    guix archive --export -r --no-grafts $(readlink -f out) > jmp-pay.nar
    plzip jmp-pay.nar
