Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added simple attic watch store example #187

Merged
merged 2 commits into from
Jun 15, 2024
Merged

Conversation

mannp
Copy link
Contributor

@mannp mannp commented Jun 14, 2024

This is a simple but working systemd service to upload the contents of the local buildbox-nix store to an attic cache, for use my other machines/nodes.

@Mic92
Copy link
Member

Mic92 commented Jun 14, 2024

I added some suggestions above. I have not tested them yet. Could you try to apply them in your setup? Thanks!

@Mic92
Copy link
Member

Mic92 commented Jun 14, 2024

The CI error I can address later myself.

@mannp
Copy link
Contributor Author

mannp commented Jun 14, 2024

I had full expectation you would rip it apart lol, but hey, I will apply to mine for sure :)

It doesn't start though for me;

Jun 14 15:58:16 tcan attic-watch-store-start[1017725]: + ATTIC_TOKEN=<redacted>
Jun 14 15:58:16 tcan attic-watch-store-start[1017725]: + attic login prod https://cache.domain.com
Jun 14 15:58:16 tcan attic-watch-store-start[1017745]: terminate called after throwing an instance of 'nix::Error'
Jun 14 15:58:16 tcan attic-watch-store-start[1017745]:   what():  error: cannot determine user's home directory
Jun 14 15:58:18 tcan attic-watch-store-start[1017725]: /nix/store/wlmy9rjzgcb1k7fdqq0w1qvb9p140cnc-unit-script-attic-watch-store-start/bin/attic-watch-store-start: line 5: 1017745 Aborted                 (core dumped) attic login prod https://cache.domain.com $ATTIC_TOKEN
Jun 14 15:58:18 tcan systemd[1]: attic-watch-store.service: Main process exited, code=exited, status=134/n/a
Jun 14 15:58:18 tcan systemd[1]: attic-watch-store.service: Failed with result 'exit-code'.
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
set -e
set -eux -o pipefail
ATTIC_TOKEN=$(< $CREDENTIALS_DIRECTORY/prod-auth-token)
attic login prod https://cache.domain.com $ATTIC_TOKEN
attic use prod
exec attic watch-store prod:prod

@mannp
Copy link
Contributor Author

mannp commented Jun 14, 2024

Yes that works now for me 👍🏻

@Mic92
Copy link
Member

Mic92 commented Jun 15, 2024

Looks like attic-client is now in nixpkgs. So I just replaced the attic flake with that as it saves the user some rebuilds.

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
@Mic92
Copy link
Member

Mic92 commented Jun 15, 2024

@mergify queue

Copy link

mergify bot commented Jun 15, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 51653df

@mergify mergify bot merged commit 51653df into nix-community:main Jun 15, 2024
11 checks passed
@mannp
Copy link
Contributor Author

mannp commented Jun 15, 2024

Looks like attic-client is now in nixpkgs. So I just replaced the attic flake with that as it saves the user some rebuilds.

Okay with me, with the mental note that it may cause version mismatches if the flake module is used to configure the main attic service.

#, inputs is no longer required with the removal of the flake.

@Mic92
Copy link
Member

Mic92 commented Jun 15, 2024

The module also seems to use the server provided by nixpkgs from the looks of it: https://github.com/zhaofengli/attic/blob/717cc95983cdc357bc347d70be20ced21f935843/flake.nix#L183
So that should be reasonable in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants