aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/abstractsettingtojson.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/abstractsettingtojson.hh')
-rw-r--r--src/libutil/abstractsettingtojson.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libutil/abstractsettingtojson.hh b/src/libutil/abstractsettingtojson.hh
new file mode 100644
index 000000000..b3fbc84f7
--- /dev/null
+++ b/src/libutil/abstractsettingtojson.hh
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <nlohmann/json.hpp>
+#include "config.hh"
+
+namespace nix {
+template<typename T>
+std::map<std::string, nlohmann::json> BaseSetting<T>::toJSONObject()
+{
+ auto obj = AbstractSetting::toJSONObject();
+ obj.emplace("value", value);
+ obj.emplace("defaultValue", defaultValue);
+ return obj;
+}
+}