Skip to content

Commit

Permalink
feat: Add NixCmd::extra_access_tokens
Browse files Browse the repository at this point in the history
This is intended to pass GitHub access token for fetchig private repos,
or to get over the rate limits.
  • Loading branch information
srid committed Jun 5, 2024
1 parent 442f1c7 commit eb26d88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "nix_rs"
# Important: remember to update the top-level Cargo.toml if updating major version
version = "0.4.0"
version = "0.5.0"
license = "Apache-2.0"
repository = "https://github.com/juspay/nix-rs"
description = "Rust library for interacting with the Nix command"
Expand Down
6 changes: 6 additions & 0 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use tracing::instrument;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
pub struct NixCmd {
pub extra_experimental_features: Vec<String>,
pub extra_access_tokens: Vec<String>,
pub refresh: Refresh,
}

Expand All @@ -44,6 +45,7 @@ impl Default for NixCmd {
fn default() -> Self {
Self {
extra_experimental_features: vec!["nix-command".to_string(), "flakes".to_string()],
extra_access_tokens: vec![],
refresh: false.into(),
}
}
Expand Down Expand Up @@ -155,6 +157,10 @@ impl NixCmd {
args.push("--extra-experimental-features".to_string());
args.push(self.extra_experimental_features.join(" "));
}
if !self.extra_access_tokens.is_empty() {
args.push("--extra-access-tokens".to_string());
args.push(self.extra_access_tokens.join(" "));
}
if self.refresh.0 {
args.push("--refresh".to_string());
}
Expand Down

0 comments on commit eb26d88

Please sign in to comment.