diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-09-06T14·20+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-09-06T14·20+0200 |
commit | dff440aab32131b3459cadc2c4cc60c6f42674c6 (patch) | |
tree | a8a0634eb1e9766857cd1c2429809349421e495c /src/nix | |
parent | df4342bc175a153986ebcf5bce2a758d5353adeb (diff) |
nix build: Add --out-link and --no-link options
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/build.cc | 30 | ||||
-rw-r--r-- | src/nix/copy.cc | 2 | ||||
-rw-r--r-- | src/nix/run.cc | 2 |
3 files changed, 24 insertions, 10 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc index 64bcafd2d934..4240f06ade7d 100644 --- a/src/nix/build.cc +++ b/src/nix/build.cc @@ -7,8 +7,22 @@ using namespace nix; struct CmdBuild : MixDryRun, InstallablesCommand { + Path outLink = "result"; + CmdBuild() { + mkFlag() + .longName("out-link") + .shortName('o') + .description("path of the symlink to the build result") + .arity(1) + .labels({"path"}) + .dest(&outLink); + + mkFlag() + .longName("no-link") + .description("do not create a symlink to the build result") + .set(&outLink, Path("")); } std::string name() override @@ -28,14 +42,14 @@ struct CmdBuild : MixDryRun, InstallablesCommand for (size_t i = 0; i < buildables.size(); ++i) { auto & b(buildables[i]); - for (auto & output : b.outputs) { - if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) { - std::string symlink = "result"; - if (i) symlink += fmt("-%d", i); - if (output.first != "out") symlink += fmt("-%s", output.first); - store2->addPermRoot(output.second, absPath(symlink), true); - } - } + if (outLink != "") + for (auto & output : b.outputs) + if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) { + std::string symlink = outLink; + if (i) symlink += fmt("-%d", i); + if (output.first != "out") symlink += fmt("-%s", output.first); + store2->addPermRoot(output.second, absPath(symlink), true); + } } } }; diff --git a/src/nix/copy.cc b/src/nix/copy.cc index d9e6c949352b..fe963e794277 100644 --- a/src/nix/copy.cc +++ b/src/nix/copy.cc @@ -22,7 +22,7 @@ struct CmdCopy : StorePathsCommand mkFlag() .longName("no-check-sigs") .description("do not require that paths are signed by trusted keys") - .handler([&](Strings ss) { checkSigs = NoCheckSigs; }); + .set(&checkSigs, NoCheckSigs); } std::string name() override diff --git a/src/nix/run.cc b/src/nix/run.cc index f016b04a1ec8..64a5cbd304d2 100644 --- a/src/nix/run.cc +++ b/src/nix/run.cc @@ -41,7 +41,7 @@ struct CmdRun : InstallablesCommand .longName("ignore-environment") .shortName('i') .description("clear the entire environment (except those specified with --keep)") - .handler([&](Strings ss) { ignoreEnvironment = true; }); + .set(&ignoreEnvironment, true); mkFlag() .longName("keep") |