diff --git a/ofborg/src/evalchecker.rs b/ofborg/src/evalchecker.rs index 0f0c8c8..1089dec 100644 --- a/ofborg/src/evalchecker.rs +++ b/ofborg/src/evalchecker.rs @@ -28,7 +28,7 @@ impl EvalChecker { pub fn execute(&self, path: &Path) -> Result { self.nix - .safely(self.op.clone(), path, self.args.clone(), false) + .safely(&self.op, path, self.args.clone(), false) } pub fn cli_cmd(&self) -> String { diff --git a/ofborg/src/nix.rs b/ofborg/src/nix.rs index 3dae39e..2944427 100644 --- a/ofborg/src/nix.rs +++ b/ofborg/src/nix.rs @@ -157,7 +157,7 @@ impl Nix { attrargs.push(attr); } - self.safe_command(Operation::Instantiate, nixpkgs, attrargs) + self.safe_command(&Operation::Instantiate, nixpkgs, attrargs) } pub fn safely_build_attrs( @@ -188,17 +188,17 @@ impl Nix { attrargs.push(attr); } - self.safe_command(Operation::Build, nixpkgs, attrargs) + self.safe_command(&Operation::Build, nixpkgs, attrargs) } pub fn safely( &self, - op: Operation, + op: &Operation, nixpkgs: &Path, args: Vec, keep_stdout: bool, ) -> Result { - self.run(self.safe_command(op, nixpkgs, args), keep_stdout) + self.run(self.safe_command(&op, nixpkgs, args), keep_stdout) } pub fn run(&self, mut cmd: Command, keep_stdout: bool) -> Result { @@ -228,7 +228,7 @@ impl Nix { } } - pub fn safe_command(&self, op: Operation, nixpkgs: &Path, args: Vec) -> Command { + pub fn safe_command(&self, op: &Operation, nixpkgs: &Path, args: Vec) -> Command { let nixpath = format!("nixpkgs={}", nixpkgs.display()); let mut command = op.command(); @@ -419,7 +419,7 @@ mod tests { assert_eq!(op.to_string(), "nix-build"); let ret: Result = nix.run( - nix.safe_command(op, build_path().as_path(), vec![String::from("--version")]), + nix.safe_command(&op, build_path().as_path(), vec![String::from("--version")]), true, ); @@ -437,7 +437,7 @@ mod tests { assert_eq!(op.to_string(), "nix-instantiate"); let ret: Result = nix.run( - nix.safe_command(op, build_path().as_path(), vec![String::from("--version")]), + nix.safe_command(&op, build_path().as_path(), vec![String::from("--version")]), true, ); @@ -451,7 +451,7 @@ mod tests { assert_eq!(op.to_string(), "nix-env -qa --json"); let ret: Result = nix.run( - nix.safe_command(op, build_path().as_path(), vec![String::from("--version")]), + nix.safe_command(&op, build_path().as_path(), vec![String::from("--version")]), true, ); @@ -469,7 +469,7 @@ mod tests { assert_eq!(op.to_string(), "nix-env -qaP --no-name --out-path"); let ret: Result = nix.run( - nix.safe_command(op, build_path().as_path(), vec![String::from("--version")]), + nix.safe_command(&op, build_path().as_path(), vec![String::from("--version")]), true, ); @@ -488,7 +488,7 @@ mod tests { let nix = nix(); let ret: Result = nix.run( - nix.safe_command(env_noop(), build_path().as_path(), vec![]), + nix.safe_command(&env_noop(), build_path().as_path(), vec![]), true, ); @@ -515,7 +515,7 @@ mod tests { ); let ret: Result = nix.run( - nix.safe_command(env_noop(), build_path().as_path(), vec![]), + nix.safe_command(&env_noop(), build_path().as_path(), vec![]), true, ); @@ -538,7 +538,7 @@ mod tests { let op = noop(Operation::Build); let ret: Result = - nix.run(nix.safe_command(op, build_path().as_path(), vec![]), true); + nix.run(nix.safe_command(&op, build_path().as_path(), vec![]), true); assert_run( ret, @@ -668,7 +668,7 @@ mod tests { #[test] fn instantiation_success() { let ret: Result = nix().safely( - Operation::Instantiate, + &Operation::Instantiate, passing_eval_path().as_path(), vec![], true, @@ -688,7 +688,7 @@ mod tests { #[test] fn instantiation_nixpkgs_restricted_mode() { let ret: Result = nix().safely( - Operation::Instantiate, + &Operation::Instantiate, individual_eval_path().as_path(), vec![String::from("-A"), String::from("nixpkgs-restricted-mode")], true, diff --git a/ofborg/src/outpathdiff.rs b/ofborg/src/outpathdiff.rs index d55a1f7..8ec8703 100644 --- a/ofborg/src/outpathdiff.rs +++ b/ofborg/src/outpathdiff.rs @@ -174,7 +174,7 @@ impl OutPaths { }; self.nix.safely( - nix::Operation::QueryPackagesOutputs, + &nix::Operation::QueryPackagesOutputs, &self.path, vec![ String::from("-f"), diff --git a/ofborg/src/tasks/eval/stdenvs.rs b/ofborg/src/tasks/eval/stdenvs.rs index b87c09e..8972561 100644 --- a/ofborg/src/tasks/eval/stdenvs.rs +++ b/ofborg/src/tasks/eval/stdenvs.rs @@ -89,7 +89,7 @@ impl Stdenvs { /// given system. fn evalstdenv(&self, system: &str) -> Option { let result = self.nix.with_system(system.to_owned()).safely( - nix::Operation::QueryPackagesOutputs, + &nix::Operation::QueryPackagesOutputs, &self.co, vec![ String::from("-f"),