diff --git a/src/libflake/config.cc b/src/libflake/config.cc index c248ed0a6..fd0e9c75f 100644 --- a/src/libflake/config.cc +++ b/src/libflake/config.cc @@ -31,9 +31,9 @@ namespace nix::flake { // setting name -> setting value -> allow or ignore. typedef std::map> TrustedList; -Path trustedListPath() +std::filesystem::path trustedListPath() { - return getDataDir() + "/trusted-settings.json"; + return getDataDir() / "trusted-settings.json"; } static TrustedList readTrustedList() @@ -48,7 +48,7 @@ static TrustedList readTrustedList() static void writeTrustedList(const TrustedList & trustedList) { auto path = trustedListPath(); - createDirs(dirOf(path)); + createDirs(path.parent_path()); writeFile(path, nlohmann::json(trustedList).dump()); } diff --git a/src/libflake/flakeref.cc b/src/libflake/flakeref.cc index 8c955c72d..0a55ac35c 100644 --- a/src/libflake/flakeref.cc +++ b/src/libflake/flakeref.cc @@ -74,7 +74,7 @@ FlakeRef::resolve(const fetchers::Settings & fetchSettings, Store & store, fetch FlakeRef parseFlakeRef( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir, + const std::optional & baseDir, bool allowMissing, bool isFlake, bool preserveRelativePaths) @@ -101,7 +101,7 @@ fromParsedURL(const fetchers::Settings & fetchSettings, ParsedURL && parsedURL, std::pair parsePathFlakeRefWithFragment( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir, + const std::optional & baseDir, bool allowMissing, bool isFlake, bool preserveRelativePaths) @@ -121,7 +121,7 @@ std::pair parsePathFlakeRefWithFragment( to 'baseDir'). If so, search upward to the root of the repo (i.e. the directory containing .git). */ - path = absPath(path, baseDir, true); + path = absPath(path, baseDir->string(), true); if (isFlake) { @@ -243,7 +243,7 @@ parseFlakeIdRef(const fetchers::Settings & fetchSettings, const std::string & ur std::optional> parseURLFlakeRef( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir, + const std::optional & baseDir, bool isFlake) { try { @@ -252,7 +252,7 @@ std::optional> parseURLFlakeRef( /* Here we know that the path must not contain encoded '/' or NUL bytes. */ auto path = renderUrlPathEnsureLegal(parsed.path); if (!isAbsolute(path)) - parsed.path = splitString>(absPath(path, *baseDir), "/"); + parsed.path = splitString>(absPath(path, baseDir->string()), "/"); } return fromParsedURL(fetchSettings, std::move(parsed), isFlake); } catch (BadURL &) { @@ -263,7 +263,7 @@ std::optional> parseURLFlakeRef( std::pair parseFlakeRefWithFragment( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir, + const std::optional & baseDir, bool allowMissing, bool isFlake, bool preserveRelativePaths) @@ -347,7 +347,7 @@ FlakeRef FlakeRef::canonicalize() const std::tuple parseFlakeRefWithFragmentAndExtendedOutputsSpec( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir, + const std::optional & baseDir, bool allowMissing, bool isFlake) { diff --git a/src/libflake/include/nix/flake/flake.hh b/src/libflake/include/nix/flake/flake.hh index 09255fbef..c2d597ac1 100644 --- a/src/libflake/include/nix/flake/flake.hh +++ b/src/libflake/include/nix/flake/flake.hh @@ -200,7 +200,7 @@ struct LockFlags /** * The path to a lock file to write to instead of the `flake.lock` file in the top-level flake */ - std::optional outputLockFilePath; + std::optional outputLockFilePath; /** * Flake inputs to be overridden. diff --git a/src/libflake/include/nix/flake/flakeref.hh b/src/libflake/include/nix/flake/flakeref.hh index 91c93af41..05c21bd1c 100644 --- a/src/libflake/include/nix/flake/flakeref.hh +++ b/src/libflake/include/nix/flake/flakeref.hh @@ -95,7 +95,7 @@ std::ostream & operator<<(std::ostream & str, const FlakeRef & flakeRef); FlakeRef parseFlakeRef( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir = {}, + const std::optional & baseDir = {}, bool allowMissing = false, bool isFlake = true, bool preserveRelativePaths = false); @@ -106,7 +106,7 @@ FlakeRef parseFlakeRef( std::pair parseFlakeRefWithFragment( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir = {}, + const std::optional & baseDir = {}, bool allowMissing = false, bool isFlake = true, bool preserveRelativePaths = false); @@ -117,7 +117,7 @@ std::pair parseFlakeRefWithFragment( std::tuple parseFlakeRefWithFragmentAndExtendedOutputsSpec( const fetchers::Settings & fetchSettings, const std::string & url, - const std::optional & baseDir = {}, + const std::optional & baseDir = {}, bool allowMissing = false, bool isFlake = true);