Skip to content

support a more selective watch mode via a queue+socket+post-build-hook #343

@colemickens

Description

@colemickens

Idea:

I really want to capture build outputs as they're produced, but I don't really like that cachix watch picks up things from unrelated builds.

It seems like this be fixed by utilizing a post build script. However, I don't like configuring it on the daemon because it's one extra step to do on remote builders, it would catch "all" builds again, and I try to keep my "buildargs" portable so that I always get cache hits, etc (this might be alleviated once flakes respects custom nix conf).

But, it seems like we would need to "queue" the signing+pushing still and do it out-of-band from the builds. That's where cachix can play a role:

  1. Start cachix, listen on a socket, sign+push paths when told about them over the socket
  2. Let the user use the post-build-hook to send paths to that socket on success nix build
# untested, example (can't remember if I need to force it to not interpolate OUT_PATHS yet)

cat<<EOF >/tmp/script.sh
echo "${OUT_PATHS[@]}"  | cachix --queue-socket /tmp/cachix.sock"
EOF

cachix --watch-socket /tmp/cachix.sock
nix build '.#hello' -L --option post-build-hook "/tmp/script.sh"

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions