aboutsummaryrefslogtreecommitdiff
path: root/src/nix/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-03-31 14:46:15 +0200
committerGitHub <noreply@github.com>2020-03-31 14:46:15 +0200
commita7540294cfae82c098e8691cd5212a9184add574 (patch)
treee6ddf26579b0a887717d9cde7ddfccdf068bd703 /src/nix/build.cc
parentd4d456c6b16196d2acced587a9cb121bfce2a560 (diff)
parent3166b97174ab879dac3b19eb3f257e73a943fef0 (diff)
Merge pull request #3460 from NixOS/dev-shell
Backport 'nix dev-shell' from the flakes branch
Diffstat (limited to 'src/nix/build.cc')
-rw-r--r--src/nix/build.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc
index 3c9d2df39..0b0762836 100644
--- a/src/nix/build.cc
+++ b/src/nix/build.cc
@@ -5,7 +5,7 @@
using namespace nix;
-struct CmdBuild : MixDryRun, InstallablesCommand
+struct CmdBuild : InstallablesCommand, MixDryRun, MixProfile
{
Path outLink = "result";
@@ -40,6 +40,10 @@ struct CmdBuild : MixDryRun, InstallablesCommand
"To build the build.x86_64-linux attribute from release.nix:",
"nix build -f release.nix build.x86_64-linux"
},
+ Example{
+ "To make a profile point at GNU Hello:",
+ "nix build --profile /tmp/profile nixpkgs.hello"
+ },
};
}
@@ -49,18 +53,19 @@ struct CmdBuild : MixDryRun, InstallablesCommand
if (dryRun) return;
- for (size_t i = 0; i < buildables.size(); ++i) {
- auto & b(buildables[i]);
-
- if (outLink != "")
- for (auto & output : b.outputs)
+ if (outLink != "") {
+ for (size_t i = 0; i < buildables.size(); ++i) {
+ for (auto & output : buildables[i].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);
}
+ }
}
+
+ updateProfile(buildables);
}
};