From 99f93f78f309d83dbf4bf12c35ff20427001eb03 Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 3 Apr 2024 08:31:11 +0000 Subject: [PATCH 1/2] Add a test failure case for the impure option Forces evaluation of the procfile to test that code path with `--impure`. --- tests/impure/devenv.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/impure/devenv.nix b/tests/impure/devenv.nix index 9e9a2091a..db06ca451 100644 --- a/tests/impure/devenv.nix +++ b/tests/impure/devenv.nix @@ -2,4 +2,7 @@ enterTest = '' echo ${builtins.currentSystem}; ''; + + # Test procfile evaluation with --impure + processes.hello.exec = "echo hello"; } From bdcb457450a574632519af6aae6112a0c48e8dad Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 3 Apr 2024 08:15:02 +0000 Subject: [PATCH 2/2] Fix devenv up with the impure option Only pass the `--impure` option to the modern nix command that supports it. --- devenv/src/command.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/devenv/src/command.rs b/devenv/src/command.rs index 15fdccc7a..3d9a0a18d 100644 --- a/devenv/src/command.rs +++ b/devenv/src/command.rs @@ -140,7 +140,11 @@ impl App { }; if self.cli.impure || self.config.impure { - flags.push("--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. + if command == "nix" { + flags.push("--impure"); + } // set a dummy value to overcome https://github.com/NixOS/nix/issues/10247 cmd.env("NIX_PATH", ":"); }