aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/config.cc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2021-05-08 21:31:28 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2021-05-08 21:31:28 -0500
commit2f63cc02de5e319708157f2b56f69581106e59b8 (patch)
tree5d28e0f6268c05024496c63db94a3896fcf0e7c2 /src/libexpr/flake/config.cc
parentfe3a10a9b2c61ba19b24da4c93c4abc9e7583f3d (diff)
Create parent trusted list path before writing
This makes sure that $HOME/.local/share/nix exists before we try to write to it.
Diffstat (limited to 'src/libexpr/flake/config.cc')
-rw-r--r--src/libexpr/flake/config.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libexpr/flake/config.cc b/src/libexpr/flake/config.cc
index 63566131e..c8a5a319f 100644
--- a/src/libexpr/flake/config.cc
+++ b/src/libexpr/flake/config.cc
@@ -22,7 +22,9 @@ static TrustedList readTrustedList()
static void writeTrustedList(const TrustedList & trustedList)
{
- writeFile(trustedListPath(), nlohmann::json(trustedList).dump());
+ auto path = trustedListPath();
+ createDirs(dirOf(path));
+ writeFile(path, nlohmann::json(trustedList).dump());
}
void ConfigFile::apply()