Revert "lib,doc: remove obvious usages of toString on paths"

Changed files
+8 -8
doc
lib
+1 -1
doc/doc-support/lib-function-locations.nix
···
substr = builtins.substring prefixLen filenameLen filename;
in substr;
-
removeNixpkgs = removeFilenamePrefix pkgs.path;
+
removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path);
liblocations =
builtins.filter
+5 -5
lib/sources.nix
···
origSrc = if isFiltered then src.origSrc else src;
in lib.cleanSourceWith {
filter = (path: type:
-
let relPath = lib.removePrefix (origSrc + "/") (path);
+
let relPath = lib.removePrefix (toString origSrc + "/") (toString path);
in lib.any (re: match re relPath != null) regexes);
inherit src;
};
···
*/
commitIdFromGitRepo =
let readCommitFromFile = file: path:
-
let fileName = path + "/" + file;
-
packedRefsName = path + "/packed-refs";
+
let fileName = toString path + "/" + file;
+
packedRefsName = toString path + "/packed-refs";
absolutePath = base: path:
if lib.hasPrefix "/" path
then path
-
else /. + "${base}/${path}";
+
else toString (/. + "${base}/${path}");
in if pathIsRegularFile path
# Resolve git worktrees. See gitrepository-layout(5)
then
···
pathHasContext = builtins.hasContext or (lib.hasPrefix storeDir);
-
canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext src);
+
canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext (toString src));
# -------------------------------------------------------------------------- #
# Internal functions
+2 -2
lib/trivial.nix
···
# Default value to return if revision can not be determined
default:
let
-
revisionFile = ./.. + "/.git-revision";
-
gitRepo = ./.. + "/.git";
+
revisionFile = "${toString ./..}/.git-revision";
+
gitRepo = "${toString ./..}/.git";
in if lib.pathIsGitRepo gitRepo
then lib.commitIdFromGitRepo gitRepo
else if lib.pathExists revisionFile then lib.fileContents revisionFile