aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/describe-stores.cc44
-rw-r--r--src/nix/develop.cc2
-rw-r--r--src/nix/diff-closures.cc2
-rw-r--r--src/nix/doctor.cc4
-rw-r--r--src/nix/installables.hh2
-rw-r--r--src/nix/local.mk2
-rw-r--r--src/nix/main.cc1
7 files changed, 51 insertions, 6 deletions
diff --git a/src/nix/describe-stores.cc b/src/nix/describe-stores.cc
new file mode 100644
index 000000000..0cc2d9337
--- /dev/null
+++ b/src/nix/describe-stores.cc
@@ -0,0 +1,44 @@
+#include "command.hh"
+#include "common-args.hh"
+#include "shared.hh"
+#include "store-api.hh"
+
+#include <nlohmann/json.hpp>
+
+using namespace nix;
+
+struct CmdDescribeStores : Command, MixJSON
+{
+ std::string description() override
+ {
+ return "show registered store types and their available options";
+ }
+
+ Category category() override { return catUtility; }
+
+ void run() override
+ {
+ auto res = nlohmann::json::object();
+ for (auto & implem : *Implementations::registered) {
+ auto storeConfig = implem.getConfig();
+ auto storeName = storeConfig->name();
+ res[storeName] = storeConfig->toJSON();
+ }
+ if (json) {
+ std::cout << res;
+ } else {
+ for (auto & [storeName, storeConfig] : res.items()) {
+ std::cout << "## " << storeName << std::endl << std::endl;
+ for (auto & [optionName, optionDesc] : storeConfig.items()) {
+ std::cout << "### " << optionName << std::endl << std::endl;
+ std::cout << optionDesc["description"].get<std::string>() << std::endl;
+ std::cout << "default: " << optionDesc["defaultValue"] << std::endl <<std::endl;
+ if (!optionDesc["aliases"].empty())
+ std::cout << "aliases: " << optionDesc["aliases"] << std::endl << std::endl;
+ }
+ }
+ }
+ }
+};
+
+static auto r1 = registerCommand<CmdDescribeStores>("describe-stores");
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index a2ce9c8c1..f29fa71d2 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -392,7 +392,7 @@ struct CmdDevelop : Common, MixEnvironment
auto bashInstallable = std::make_shared<InstallableFlake>(
state,
- std::move(installable->nixpkgsFlakeRef()),
+ installable->nixpkgsFlakeRef(),
Strings{"bashInteractive"},
Strings{"legacyPackages." + settings.thisSystem.get() + "."},
lockFlags);
diff --git a/src/nix/diff-closures.cc b/src/nix/diff-closures.cc
index 4199dae0f..0dc99d05e 100644
--- a/src/nix/diff-closures.cc
+++ b/src/nix/diff-closures.cc
@@ -81,7 +81,7 @@ void printClosureDiff(
auto beforeSize = totalSize(beforeVersions);
auto afterSize = totalSize(afterVersions);
auto sizeDelta = (int64_t) afterSize - (int64_t) beforeSize;
- auto showDelta = abs(sizeDelta) >= 8 * 1024;
+ auto showDelta = std::abs(sizeDelta) >= 8 * 1024;
std::set<std::string> removed, unchanged;
for (auto & [version, _] : beforeVersions)
diff --git a/src/nix/doctor.cc b/src/nix/doctor.cc
index 82e92cdd0..683e91446 100644
--- a/src/nix/doctor.cc
+++ b/src/nix/doctor.cc
@@ -49,9 +49,7 @@ struct CmdDoctor : StoreCommand
{
logger->log("Running checks against store uri: " + store->getUri());
- auto type = getStoreType();
-
- if (type < tOther) {
+ if (store.dynamic_pointer_cast<LocalFSStore>()) {
success &= checkNixInPath();
success &= checkProfileRoots(store);
}
diff --git a/src/nix/installables.hh b/src/nix/installables.hh
index 41c75a4ed..c7c2f8981 100644
--- a/src/nix/installables.hh
+++ b/src/nix/installables.hh
@@ -69,7 +69,7 @@ struct Installable
virtual FlakeRef nixpkgsFlakeRef() const
{
- return std::move(FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}}));
+ return FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}});
}
};
diff --git a/src/nix/local.mk b/src/nix/local.mk
index e96200685..ab4e9121b 100644
--- a/src/nix/local.mk
+++ b/src/nix/local.mk
@@ -29,3 +29,5 @@ $(eval $(call install-symlink, $(bindir)/nix, $(libexecdir)/nix/build-remote))
src/nix-env/user-env.cc: src/nix-env/buildenv.nix.gen.hh
src/nix/develop.cc: src/nix/get-env.sh.gen.hh
+
+src/nix-channel/nix-channel.cc: src/nix-channel/unpack-channel.nix.gen.hh
diff --git a/src/nix/main.cc b/src/nix/main.cc
index e9479f564..1e9e07bc0 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -185,6 +185,7 @@ void mainWrapped(int argc, char * * argv)
}
if (argc == 2 && std::string(argv[1]) == "__dump-builtins") {
+ evalSettings.pureEval = false;
EvalState state({}, openStore("dummy://"));
auto res = nlohmann::json::object();
auto builtins = state.baseEnv.values[0]->attrs;