From 45796a9b7a16a09e3eb41f626f79e30b419498bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sat, 13 Apr 2024 08:36:40 +0100 Subject: [PATCH] Fix #1118: add --offline --- devenv/src/command.rs | 5 +++++ devenv/src/main.rs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/devenv/src/command.rs b/devenv/src/command.rs index 3d9a0a18d..e58fc353e 100644 --- a/devenv/src/command.rs +++ b/devenv/src/command.rs @@ -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. @@ -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(); diff --git a/devenv/src/main.rs b/devenv/src/main.rs index 0b7afb3f2..294507ae4 100644 --- a/devenv/src/main.rs +++ b/devenv/src/main.rs @@ -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,