diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2020-06-29 10:05:44 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2020-07-31 17:17:03 +0200 |
commit | 5a09eb86f17b7949b93724ecb51f1b909ea68592 (patch) | |
tree | 246a7ac2bbcfc0d663361901ef6bb8a92050813e /src/nix/build.cc | |
parent | 17f75f9cc4dd70e3e6de7e266ef2bd18a0da310b (diff) |
nix/build: add `--rebuild` option
Occasionally, `nix-build --check` is fairly helpful and I'd like to be
able to use this feature for flakes that need to be built with `nix
build` as well.
Diffstat (limited to 'src/nix/build.cc')
-rw-r--r-- | src/nix/build.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc index 0f7e0e123..bec25d8d8 100644 --- a/src/nix/build.cc +++ b/src/nix/build.cc @@ -9,6 +9,7 @@ using namespace nix; struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile { Path outLink = "result"; + BuildMode buildMode = bmNormal; CmdBuild() { @@ -26,6 +27,12 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile .description = "do not create a symlink to the build result", .handler = {&outLink, Path("")}, }); + + addFlag({ + .longName = "rebuild", + .description = "Rebuild an already built package locally and compare the result to the existing store-paths.", + .handler = {&buildMode, bmCheck}, + }); } std::string description() override @@ -53,7 +60,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile void run(ref<Store> store) override { - auto buildables = build(store, dryRun ? Realise::Nothing : Realise::Outputs, installables); + auto buildables = build(store, dryRun ? Realise::Nothing : Realise::Outputs, installables, buildMode); if (dryRun) return; |