1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 09:11:47 +02:00

Hide the "dirty" notice when running nix develop

In the common case, nix develop is running against a dirty checkout of a project.
This patch removes the warning about a dirty tree on nix develop only.

Close FH-736
This commit is contained in:
Graham Christensen 2025-04-23 20:54:53 -04:00
parent a8979e05b1
commit d74acf1954
3 changed files with 13 additions and 0 deletions

View file

@ -214,6 +214,8 @@ struct InstallableCommand : virtual Args, SourceExprCommand
{
InstallableCommand();
virtual void preRun(ref<Store> store);
virtual void run(ref<Store> store, ref<Installable> installable) = 0;
void run(ref<Store> store) override;

View file

@ -903,8 +903,13 @@ InstallableCommand::InstallableCommand()
});
}
void InstallableCommand::preRun(ref<Store> store)
{
}
void InstallableCommand::run(ref<Store> store)
{
preRun(store);
auto installable = parseInstallable(store, _installable);
run(store, std::move(installable));
}

View file

@ -1,5 +1,6 @@
#include "nix/util/config-global.hh"
#include "nix/expr/eval.hh"
#include "nix/fetchers/fetch-settings.hh"
#include "nix/cmd/installable-flake.hh"
#include "nix/cmd/command-installable-value.hh"
#include "nix/main/common-args.hh"
@ -583,6 +584,11 @@ struct CmdDevelop : Common, MixEnvironment
;
}
void preRun(ref<Store> store) override
{
fetchSettings.warnDirty = false;
}
void run(ref<Store> store, ref<Installable> installable) override
{
auto [buildEnvironment, gcroot] = getBuildEnvironment(store, installable);