summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2022-11-05 21:57:23 -0300
committerGitHub <noreply@github.com>2022-11-05 21:57:23 -0300
commit4b59590ac5326b82581e96f4eb1ff7417c932387 (patch)
tree47d234770107b9c1b5b66851e43a24a25265764b
parente6c6826d4252f670fa7afd80ea5cbb8db23bc027 (diff)
Revert "lib,doc: remove obvious usages of toString on paths"
-rw-r--r--doc/doc-support/lib-function-locations.nix2
-rw-r--r--lib/sources.nix10
-rw-r--r--lib/trivial.nix4
3 files changed, 8 insertions, 8 deletions
diff --git a/doc/doc-support/lib-function-locations.nix b/doc/doc-support/lib-function-locations.nix
index ac4da88052da..68edd2709854 100644
--- a/doc/doc-support/lib-function-locations.nix
+++ b/doc/doc-support/lib-function-locations.nix
@@ -38,7 +38,7 @@ let
substr = builtins.substring prefixLen filenameLen filename;
in substr;
- removeNixpkgs = removeFilenamePrefix pkgs.path;
+ removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path);
liblocations =
builtins.filter
diff --git a/lib/sources.nix b/lib/sources.nix
index b7fb71bd0b0b..cec395c9bb18 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -140,7 +140,7 @@ let
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;
};
@@ -175,12 +175,12 @@ let
*/
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
@@ -226,7 +226,7 @@ let
pathHasContext = builtins.hasContext or (lib.hasPrefix storeDir);
- canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext src);
+ canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext (toString src));
# -------------------------------------------------------------------------- #
# Internal functions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 8f2023caaf8e..5d4fad8266bc 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -213,8 +213,8 @@ rec {
# 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