Skip to content

Commit

Permalink
Allow caching ovveride for nix flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Jun 17, 2024
1 parent 0dac15d commit 33c932f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions devenv/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ pub struct GlobalOptions {
)]
pub impure: bool,

#[arg(long, global = true, help = "Use flake cache.")]
pub eval_cache: bool,

#[arg(
long,
global = true,
Expand Down Expand Up @@ -96,6 +99,7 @@ impl Default for GlobalOptions {
cores: 2,
system: default_system(),
impure: false,
eval_cache: false,
offline: false,
clean: None,
nix_debugger: false,
Expand Down
11 changes: 6 additions & 5 deletions devenv/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::HashMap;
use std::env;
use std::os::unix::process::CommandExt;

const NIX_FLAGS: [&str; 12] = [
const NIX_FLAGS: [&str; 9] = [
"--show-trace",
"--extra-experimental-features",
"nix-command",
Expand All @@ -15,10 +15,6 @@ const NIX_FLAGS: [&str; 12] = [
"--option",
"warn-dirty",
"false",
// flake caching is too aggressive
"--option",
"eval-cache",
"false",
// always build all dependencies and report errors at the end
"--keep-going",
];
Expand Down Expand Up @@ -117,6 +113,11 @@ impl Devenv {
let max_jobs = self.global_options.max_jobs.to_string();
flags.push(&max_jobs);

flags.push("--option");
flags.push("eval-cache");
let eval_cache = self.global_options.eval_cache.to_string();
flags.push(&eval_cache);

// handle --nix-option key value
for chunk in self.global_options.nix_option.chunks_exact(2) {
flags.push("--option");
Expand Down

0 comments on commit 33c932f

Please sign in to comment.