feat: add option for nix-env arguments (#555)
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
#suse_dup = false
|
||||
#rpm_ostree = false
|
||||
#nix_arguments = "--flake"
|
||||
#nix_env_arguments = "--prebuilt-only"
|
||||
|
||||
[git]
|
||||
#max_concurrency = 5
|
||||
|
||||
@@ -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>,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user