add option to disable cache.nixos.org
This commit is contained in:
parent
68df59ad25
commit
ce0e70f95a
3 changed files with 11 additions and 9 deletions
|
@ -30,8 +30,8 @@ Options:
|
||||||
If unspecified, will get it form AWS_DEFAULT_REGION envar or default to us-east-1
|
If unspecified, will get it form AWS_DEFAULT_REGION envar or default to us-east-1
|
||||||
--endpoint <ENDPOINT>
|
--endpoint <ENDPOINT>
|
||||||
If unspecifed, will get it from AWS_ENDPOINT envar e.g. https://s3.example.com
|
If unspecifed, will get it from AWS_ENDPOINT envar e.g. https://s3.example.com
|
||||||
--skip-signature-check
|
--no-default-upstream
|
||||||
|
Do not include cache.nixos.org as upstream
|
||||||
-h, --help
|
-h, --help
|
||||||
Print help
|
Print help
|
||||||
```
|
```
|
||||||
|
|
|
@ -55,8 +55,9 @@ pub struct PushArgs {
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
endpoint: Option<String>,
|
endpoint: Option<String>,
|
||||||
|
|
||||||
|
/// Do not include cache.nixos.org as upstream
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
skip_signature_check: bool,
|
no_default_upstream: bool,
|
||||||
|
|
||||||
/// Path to upload
|
/// Path to upload
|
||||||
/// e.g. ./result or /nix/store/y4qpcibkj767szhjb58i2sidmz8m24hb-hello-2.12.1
|
/// e.g. ./result or /nix/store/y4qpcibkj767szhjb58i2sidmz8m24hb-hello-2.12.1
|
||||||
|
|
13
src/push.rs
13
src/push.rs
|
@ -1,7 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
fs,
|
fs,
|
||||||
iter::once,
|
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::{
|
sync::{
|
||||||
Arc,
|
Arc,
|
||||||
|
@ -39,11 +38,13 @@ pub struct Push {
|
||||||
impl Push {
|
impl Push {
|
||||||
pub async fn new(cli: &PushArgs, store: Store) -> Result<Self> {
|
pub async fn new(cli: &PushArgs, store: Store) -> Result<Self> {
|
||||||
let mut upstreams = Vec::with_capacity(cli.upstreams.len() + 1);
|
let mut upstreams = Vec::with_capacity(cli.upstreams.len() + 1);
|
||||||
for upstream in cli
|
if !cli.no_default_upstream {
|
||||||
.upstreams
|
upstreams.push(
|
||||||
.iter()
|
Url::parse("https://cache.nixos.org")
|
||||||
.chain(once(&"https://cache.nixos.org".to_string()))
|
.expect("default upstream must be a valid url"),
|
||||||
{
|
);
|
||||||
|
}
|
||||||
|
for upstream in &cli.upstreams {
|
||||||
upstreams
|
upstreams
|
||||||
.push(Url::parse(upstream).context(format!("failed to parse {upstream} as url"))?);
|
.push(Url::parse(upstream).context(format!("failed to parse {upstream} as url"))?);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue