Skip to content

Commit

Permalink
Fix #1118: add --offline
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Apr 13, 2024
1 parent 7ddfa99 commit 45796a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions devenv/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ impl App {
}
};

if self.cli.offline && command == "nix" {
flags.push("--offline");
}

if self.cli.impure || self.config.impure {
// only pass the impure option to the nix command that supports it.
// avoid passing it to the older utilities, e.g. like `nix-store` when creating GC roots.
Expand All @@ -154,6 +158,7 @@ impl App {
.first()
.map(|arg| arg == &"build" || arg == &"print-dev-env")
.unwrap_or(false)
&& !self.cli.offline
{
let cachix_caches = self.get_cachix_caches();

Expand Down
7 changes: 7 additions & 0 deletions devenv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ struct Cli {
#[arg(short, long, help = "Relax the hermeticity of the environment.")]
impure: bool,

#[arg(
short,
long,
help = "Disable substituters and consider all previously downloaded files up-to-date."
)]
offline: bool,

// TODO: --no-clean?
#[arg(
short,
Expand Down

0 comments on commit 45796a9

Please sign in to comment.