about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/main.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc
index f83843415e3b..ea6838cd76c9 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -21,10 +21,30 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
             throw Exit();
         });
 
+        mkFlag(0, "help-config", "show configuration options", [=]() {
+            std::cout << "The following configuration options are available:\n\n";
+            Table2 tbl;
+            for (const auto & s : settings._getSettings())
+                if (!s.second.isAlias)
+                    tbl.emplace_back(s.first, s.second.setting->description);
+            printTable(std::cout, tbl);
+            throw Exit();
+        });
+
         mkFlag(0, "version", "show version information", std::bind(printVersion, programName));
 
         settings.convertToArgs(*this);
     }
+
+    void printFlags(std::ostream & out) override
+    {
+        Args::printFlags(out);
+        std::cout <<
+            "\n"
+            "In addition, most configuration settings can be overriden using ‘--<name> <value>’.\n"
+            "Boolean settings can be overriden using ‘--<name>’ or ‘--no-<name>’. See ‘nix\n"
+            "--help-config’ for a list of configuration settings.\n";
+    }
 };
 
 void mainWrapped(int argc, char * * argv)