From 48e44628fb3246cf06947295604d041791a00597 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 14 Apr 2025 12:08:43 -0400 Subject: [PATCH] update readme --- README.md | 52 +++++++++++++++++++++++++++++++++------------------- src/main.rs | 2 +- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 9265a87..ff71137 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,38 @@ -Runs `nix copy` under the hood but only uploads paths that don't exist in upstream caches. It's async so may also be somewhat faster. Unlike `nix copy`, we also upload build dependencies. You may also pass the `--recursive` flag to absolutely not miss anything (be warned though, it queues up a lot of paths to check against upstream caches (also idk why you'd ever want to use this honestly)). Specify upstream caches to check against with `--upstream-cache` (can be specified multiple times, `cache.nixos.org` is always included). +Uploads stuff to your s3 binary cache, but skip stuff that exist on upstream caches to save you space and time. Unlike `nix copy`, we also upload build dependencies meaning you just say the package or store path and we figure out the rest. Specify upstream caches to check against with `-u` (can be specified multiple times, `cache.nixos.org` is always included). + +## Usage + +Example: +``` +nixcp --bucket nixcache --signing-key ~/cache-priv-key.pem --endpoint https://s3.cy7.sh -u https://nix-community.cachix.org push github:cything/nixcp/2025-04-12 +``` +The signing key is generated with: +``` +nix-store --generate-binary-cache-key nixcache.cy7.sh cache-priv-key.pem cache-pub-key.pem +``` + +`AWS_ACCESS_KEY_ID` and `AWS_ENDPOINT_URL` environment variables should be set with your s3 credentials. ``` -Usage: nixcp [OPTIONS] --to +Usage: nixcp [OPTIONS] --bucket --signing-key -Arguments: - Package to upload to the binary cache +Commands: + push + help Print this message or the help of the given subcommand(s) Options: - --to - Address of the binary cache (passed to nix copy --to) - -u, --upstream-cache + --bucket + The s3 bucket to upload to + -u, --upstream Upstream cache to check against. Can be specified multiple times. cache.nixos.org is always included - -r, --recursive - Whether to pass --recursive to nix path-info. Can queue a huge number of paths to upload - --upstream-checker-concurrency - Concurrent upstream cache checkers [default: 32] - --uploader-concurrency - Concurrent uploaders [default: 16] - --nix-store-concurrency - Concurrent nix-store commands to run [default: 32] + --signing-key + Path to the file containing signing key e.g. ~/cache-priv-key.pem + --region + If unspecified, will get it form AWS_DEFAULT_REGION envar or the AWS default + --endpoint + If unspecifed, will get it from AWS_ENDPOINT_URL envar or the AWS default e.g. https://s3.example.com + --profile + AWS profile to use -h, --help Print help -V, --version @@ -27,13 +41,13 @@ Options: ## Install with nix ``` -nix profile install git+https://git.cy7.sh/cy/nixcp.git +nix profile install github:cything/nixcp ``` Or run without installing: ``` -nix run git+https://git.cy7.sh/cy/nixcp.git +nix run github:cything/nixcp ``` Separate arguments with `--` to pass them through to `nixcp` like so: ``` -nix run git+https://git.cy7.sh/cy/nixcp.git -- --help -``` \ No newline at end of file +nix run github:cything/nixcp -- --help +``` diff --git a/src/main.rs b/src/main.rs index 3a7cc78..f6f10df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ struct Cli { bucket: String, /// Upstream cache to check against. Can be specified multiple times. - /// cache.nixos.org is always included + /// cache.nixos.org is always included. #[arg(long = "upstream", short, value_name = "nixcache.example.com")] upstreams: Vec,