Skip to content

Instantly share code, notes, and snippets.

@zimbatm
Created June 7, 2022 10:03
Show Gist options
  • Save zimbatm/ad72f89688fee7a52f9341f9306cd02c to your computer and use it in GitHub Desktop.
Save zimbatm/ad72f89688fee7a52f9341f9306cd02c to your computer and use it in GitHub Desktop.
{ config, pkgs, ... }:
{
# Configure nix to upload build results to the cache
nix.extraOptions =
let
post-build-hook = pkgs.writeShellScript "post-build-hook" ''
#
# Invoked by post-build hooks to upload new builds to the cache
#
set -euo pipefail
set -f # disable globbing
export IFS=' '
echo "Uploading paths $OUT_PATHS"
source /run/secrets/nix_cache_writer
exec nix copy --extra-experimental-features nix-command --to "s3://manifold-nix-cache?region=us-west-2&secret-key=/run/secrets/nix_signing_key" $OUT_PATHS
'';
in
''
post-build-hook = ${post-build-hook}
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment