forked from DGNum/colmena
cargo clippy --all-targets --fix
Suggested in #169, I just ran it myself. Co-authored-by: i1i1 <vanyarybin1@live.ru>
This commit is contained in:
parent
82c8c7044a
commit
8d92dadb32
10 changed files with 17 additions and 21 deletions
|
@ -42,7 +42,7 @@ pub async fn run(_global_args: &ArgMatches, local_args: &ArgMatches) -> Result<(
|
||||||
if nix_version.at_least(2, 4) {
|
if nix_version.at_least(2, 4) {
|
||||||
// `nix repl` is expected to be marked as experimental:
|
// `nix repl` is expected to be marked as experimental:
|
||||||
// <https://github.com/NixOS/nix/issues/5604>
|
// <https://github.com/NixOS/nix/issues/5604>
|
||||||
repl_cmd.args(&["--experimental-features", "nix-command flakes"]);
|
repl_cmd.args(["--experimental-features", "nix-command flakes"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if nix_version.at_least(2, 10) {
|
if nix_version.at_least(2, 10) {
|
||||||
|
|
|
@ -80,12 +80,12 @@ impl DrvSetEvaluator for NixEvalJobs {
|
||||||
command
|
command
|
||||||
.arg("--workers")
|
.arg("--workers")
|
||||||
.arg(self.workers.to_string())
|
.arg(self.workers.to_string())
|
||||||
.args(&["--expr", &expression.expression()]);
|
.args(["--expr", &expression.expression()]);
|
||||||
|
|
||||||
command.args(flags.to_args());
|
command.args(flags.to_args());
|
||||||
|
|
||||||
if expression.requires_flakes() {
|
if expression.requires_flakes() {
|
||||||
command.args(&["--extra-experimental-features", "flakes"]);
|
command.args(["--extra-experimental-features", "flakes"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut child = command
|
let mut child = command
|
||||||
|
|
|
@ -87,8 +87,8 @@ impl FlakeMetadata {
|
||||||
/// Resolves a flake.
|
/// Resolves a flake.
|
||||||
async fn resolve(flake: &str) -> ColmenaResult<Self> {
|
async fn resolve(flake: &str) -> ColmenaResult<Self> {
|
||||||
let child = Command::new("nix")
|
let child = Command::new("nix")
|
||||||
.args(&["flake", "metadata", "--json"])
|
.args(["flake", "metadata", "--json"])
|
||||||
.args(&["--extra-experimental-features", "nix-command flakes"])
|
.args(["--extra-experimental-features", "nix-command flakes"])
|
||||||
.arg(flake)
|
.arg(flake)
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()?;
|
.spawn()?;
|
||||||
|
@ -109,8 +109,8 @@ impl FlakeMetadata {
|
||||||
/// Quietly locks the dependencies of a flake.
|
/// Quietly locks the dependencies of a flake.
|
||||||
pub async fn lock_flake_quiet(uri: &str) -> ColmenaResult<()> {
|
pub async fn lock_flake_quiet(uri: &str) -> ColmenaResult<()> {
|
||||||
let status = Command::new("nix")
|
let status = Command::new("nix")
|
||||||
.args(&["flake", "lock"])
|
.args(["flake", "lock"])
|
||||||
.args(&["--extra-experimental-features", "nix-command flakes"])
|
.args(["--extra-experimental-features", "nix-command flakes"])
|
||||||
.arg(uri)
|
.arg(uri)
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null())
|
||||||
.status()
|
.status()
|
||||||
|
|
|
@ -416,7 +416,7 @@ impl<'hive> NixInstantiate<'hive> {
|
||||||
let mut command = Command::new("nix-instantiate");
|
let mut command = Command::new("nix-instantiate");
|
||||||
|
|
||||||
if self.hive.is_flake() {
|
if self.hive.is_flake() {
|
||||||
command.args(&["--extra-experimental-features", "flakes"]);
|
command.args(["--extra-experimental-features", "flakes"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut full_expression = self.hive.get_base_expression();
|
let mut full_expression = self.hive.get_base_expression();
|
||||||
|
|
|
@ -104,13 +104,12 @@ impl Host for Local {
|
||||||
|
|
||||||
async fn get_current_system_profile(&mut self) -> ColmenaResult<Profile> {
|
async fn get_current_system_profile(&mut self) -> ColmenaResult<Profile> {
|
||||||
let paths = Command::new("readlink")
|
let paths = Command::new("readlink")
|
||||||
.args(&["-e", CURRENT_PROFILE])
|
.args(["-e", CURRENT_PROFILE])
|
||||||
.capture_output()
|
.capture_output()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let path = paths
|
let path = paths
|
||||||
.lines()
|
.lines()
|
||||||
.into_iter()
|
|
||||||
.next()
|
.next()
|
||||||
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
||||||
.to_string()
|
.to_string()
|
||||||
|
@ -121,7 +120,7 @@ impl Host for Local {
|
||||||
|
|
||||||
async fn get_main_system_profile(&mut self) -> ColmenaResult<Profile> {
|
async fn get_main_system_profile(&mut self) -> ColmenaResult<Profile> {
|
||||||
let paths = Command::new("sh")
|
let paths = Command::new("sh")
|
||||||
.args(&[
|
.args([
|
||||||
"-c",
|
"-c",
|
||||||
&format!(
|
&format!(
|
||||||
"readlink -e {} || readlink -e {}",
|
"readlink -e {} || readlink -e {}",
|
||||||
|
@ -133,7 +132,6 @@ impl Host for Local {
|
||||||
|
|
||||||
let path = paths
|
let path = paths
|
||||||
.lines()
|
.lines()
|
||||||
.into_iter()
|
|
||||||
.next()
|
.next()
|
||||||
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
||||||
.to_string()
|
.to_string()
|
||||||
|
|
|
@ -112,7 +112,6 @@ impl Host for Ssh {
|
||||||
|
|
||||||
let path = paths
|
let path = paths
|
||||||
.lines()
|
.lines()
|
||||||
.into_iter()
|
|
||||||
.next()
|
.next()
|
||||||
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
||||||
.to_string()
|
.to_string()
|
||||||
|
@ -131,7 +130,6 @@ impl Host for Ssh {
|
||||||
|
|
||||||
let path = paths
|
let path = paths
|
||||||
.lines()
|
.lines()
|
||||||
.into_iter()
|
|
||||||
.next()
|
.next()
|
||||||
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
.ok_or(ColmenaError::FailedToGetCurrentProfile)?
|
||||||
.to_string()
|
.to_string()
|
||||||
|
@ -265,7 +263,7 @@ impl Ssh {
|
||||||
// experimental `nix copy` command with ssh-ng://
|
// experimental `nix copy` command with ssh-ng://
|
||||||
let mut command = Command::new("nix");
|
let mut command = Command::new("nix");
|
||||||
|
|
||||||
command.args(&[
|
command.args([
|
||||||
"--extra-experimental-features",
|
"--extra-experimental-features",
|
||||||
"nix-command",
|
"nix-command",
|
||||||
"copy",
|
"copy",
|
||||||
|
@ -273,7 +271,7 @@ impl Ssh {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if options.use_substitutes {
|
if options.use_substitutes {
|
||||||
command.args(&[
|
command.args([
|
||||||
"--substitute-on-destination",
|
"--substitute-on-destination",
|
||||||
// needed due to UX bug in ssh-ng://
|
// needed due to UX bug in ssh-ng://
|
||||||
"--builders-use-substitutes",
|
"--builders-use-substitutes",
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl NixCheck {
|
||||||
let flakes_supported = version.has_flakes();
|
let flakes_supported = version.has_flakes();
|
||||||
|
|
||||||
let flake_cmd = Command::new("nix-instantiate")
|
let flake_cmd = Command::new("nix-instantiate")
|
||||||
.args(&["--eval", "-E", "builtins.getFlake"])
|
.args(["--eval", "-E", "builtins.getFlake"])
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null())
|
||||||
.status()
|
.status()
|
||||||
|
|
|
@ -53,13 +53,13 @@ impl Profile {
|
||||||
/// Create a GC root for this profile.
|
/// Create a GC root for this profile.
|
||||||
pub async fn create_gc_root(&self, path: &Path) -> ColmenaResult<()> {
|
pub async fn create_gc_root(&self, path: &Path) -> ColmenaResult<()> {
|
||||||
let mut command = Command::new("nix-store");
|
let mut command = Command::new("nix-store");
|
||||||
command.args(&[
|
command.args([
|
||||||
"--no-build-output",
|
"--no-build-output",
|
||||||
"--indirect",
|
"--indirect",
|
||||||
"--add-root",
|
"--add-root",
|
||||||
path.to_str().unwrap(),
|
path.to_str().unwrap(),
|
||||||
]);
|
]);
|
||||||
command.args(&["--realise", self.as_path().to_str().unwrap()]);
|
command.args(["--realise", self.as_path().to_str().unwrap()]);
|
||||||
command.stdout(Stdio::null());
|
command.stdout(Stdio::null());
|
||||||
|
|
||||||
let status = command.status().await?;
|
let status = command.status().await?;
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl StorePath {
|
||||||
/// Returns the immediate dependencies of the store path.
|
/// Returns the immediate dependencies of the store path.
|
||||||
pub async fn references(&self) -> ColmenaResult<Vec<StorePath>> {
|
pub async fn references(&self) -> ColmenaResult<Vec<StorePath>> {
|
||||||
let references = Command::new("nix-store")
|
let references = Command::new("nix-store")
|
||||||
.args(&["--query", "--references"])
|
.args(["--query", "--references"])
|
||||||
.arg(&self.0)
|
.arg(&self.0)
|
||||||
.capture_output()
|
.capture_output()
|
||||||
.await?
|
.await?
|
||||||
|
|
|
@ -279,7 +279,7 @@ pub async fn hive_from_path(hive_path: HivePath, args: &ArgMatches) -> ColmenaRe
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(opts) = args.get_many::<String>("nix-option") {
|
if let Some(opts) = args.get_many::<String>("nix-option") {
|
||||||
let iter = opts.into_iter();
|
let iter = opts;
|
||||||
|
|
||||||
let names = iter.clone().step_by(2);
|
let names = iter.clone().step_by(2);
|
||||||
let values = iter.clone().skip(1).step_by(2);
|
let values = iter.clone().skip(1).step_by(2);
|
||||||
|
|
Loading…
Reference in a new issue