Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for nix-env arguments #555

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
#suse_dup = false
#rpm_ostree = false
#nix_arguments = "--flake"
#nix_env_arguments = "--prebuilt-only"

[git]
#max_concurrency = 5
Expand Down
11 changes: 11 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ pub struct Linux {
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
nix_arguments: Option<String>,

#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
nix_env_arguments: Option<String>,

#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
apt_arguments: Option<String>,

Expand Down Expand Up @@ -1275,6 +1278,14 @@ impl Config {
.and_then(|linux| linux.nix_arguments.as_deref())
}

/// Extra nix-env arguments
pub fn nix_env_arguments(&self) -> Option<&str> {
self.config_file
.linux
.as_ref()
.and_then(|linux| linux.nix_env_arguments.as_deref())
}

/// Extra Home Manager arguments
pub fn home_manager(&self) -> Option<&Vec<String>> {
self.config_file
Expand Down
7 changes: 6 additions & 1 deletion src/steps/os/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,12 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
.arg("--verbose")
.status_checked()
} else {
run_type.execute(nix_env).arg("--upgrade").status_checked()
let mut command = run_type.execute(nix_env);
command.arg("--upgrade");
if let Some(args) = ctx.config().nix_env_arguments() {
command.args(args.split_whitespace());
};
command.status_checked()
}
}

Expand Down