#nix #nix-build #upload #cache #artifact #binary #s3-compatible

bin+lib nix-cache-watcher

Upload new nix artifacts to an s3-compatible binary cache

6 releases

0.0.7 Sep 17, 2022
0.0.5 Sep 15, 2022

#1457 in Filesystem

0BSD license

37KB
621 lines

nix-cache-watcher

Table of Contents

About

A very WIP tool for uploading Nix build artifacts to an s3 compatible binary cache. This will eventually support direct upload to s3/b2, and possibly direct singing, but at the moment it shells out to the nix to perform those operations.

Takes a snapshot of your nix store state before your build, and then signs and uploads new installable afterwards.

Getting Started

Prerequisites

This program is only intended to run on systems with nix installed, and has the following dependencies:

  • xz
  • curl

Installing

Install though cargo:

cargo install nix-cache-watcher

or through Nix:

nix registry add nix-cache-watcher 'git+https://git.sr.ht/~thatonelutenist/nix-cache-watcher?ref=trunk'
nix build nix-cache-watcher# --profile /home/build/.nix-profile

Usage

See nix-cache-watcher --help for full syntax and options.

Before starting your build, you must take a snapshot of the current nix store state:

nix-cache-watcher save-store

Then, run your build. After your build completes, first sign the new store paths, and then send them off for upload:

nix-cache-watcher sign-store -k $PATH_TO_KEY
nix-cache-watcher upload-diff -r "$CACHE_URI" -v

Note: you must already have your AWS SDK credentials configured for this to work.

Dependencies

~25–40MB
~648K SLoC