summary refs log tree commit diff
path: root/lib/sources.nix
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-11-06 06:32:22 +0200
committerArtturin <Artturin@artturin.com>2022-11-06 19:41:52 +0200
commit8c1b0192c5cf48e176bd4937787ba548e050395d (patch)
tree49caf80eb68ef416b8360981477352033b349327 /lib/sources.nix
parentb67ee6e861903abb04e9024d605dfc7b00922633 (diff)
downloadnixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.tar
nixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.tar.gz
nixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.tar.bz2
nixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.tar.lz
nixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.tar.xz
nixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.tar.zst
nixpkgs-8c1b0192c5cf48e176bd4937787ba548e050395d.zip
lib/sources: remove 2 usages of toString on a path which will be read using fileContents
It gives a warning on the lazy-trees branch of Nix
(NixOS/nix#6530)

"warning: applying 'toString' to path '...' and then accessing it is deprecated, at '...'"

'else toString (/. + "${base}/${path}");' at line 183 may still cause a warning but i don't know how
to reach that codepath and test so im leaving it untouched

changing it to 'else /. + "${base}/${path}";'
caused this error
```
error: a string that refers to a store path cannot be appended to a path

       at /home/systems/nixpkgs/lib/sources.nix:183:20:

          182|               then path
          183|               else /. + "${base}/${path}";
             |                    ^
          184|         in if pathIsRegularFile path
```
Diffstat (limited to 'lib/sources.nix')
-rw-r--r--lib/sources.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sources.nix b/lib/sources.nix
index cec395c9bb1..51836696cf1 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -175,8 +175,8 @@ let
   */
   commitIdFromGitRepo =
     let readCommitFromFile = file: path:
-        let fileName       = toString path + "/" + file;
-            packedRefsName = toString path + "/packed-refs";
+        let fileName       = path + "/${file}";
+            packedRefsName = path + "/packed-refs";
             absolutePath   = base: path:
               if lib.hasPrefix "/" path
               then path