about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorV <v@anomalous.eu>2020-08-25 12:12:05 +0200
committerV <v@anomalous.eu>2020-09-03 19:15:10 +0200
commit423fc3f232e8b88c2c49ca48202358860aadb44b (patch)
tree8e5ec4cba4e85fbdc146b86a394541d363f8eaa3 /lib
parent79921889a05a3e7f2450a82fbaadd3dd552d3806 (diff)
lib/strings: deprecate readPathsFromFile
> NOTE: This function is not performant and should be avoided.

It's not used at all in-tree now, so we can remove it completely after
any remaining users are given notice.
Diffstat (limited to 'lib')
-rw-r--r--lib/strings.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index 0baa942355c0e..9fa9f023561e1 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -689,14 +689,15 @@ rec {
             "/prefix/nix-profiles-library-paths.patch"
             "/prefix/compose-search-path.patch" ]
   */
-  readPathsFromFile = rootPath: file:
-    let
-      lines = lib.splitString "\n" (builtins.readFile file);
-      removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line));
-      relativePaths = removeComments lines;
-      absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths;
-    in
-      absolutePaths;
+  readPathsFromFile = lib.warn "lib.readPathsFromFile is deprecated, use a list instead"
+    (rootPath: file:
+      let
+        lines = lib.splitString "\n" (builtins.readFile file);
+        removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line));
+        relativePaths = removeComments lines;
+        absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths;
+      in
+        absolutePaths);
 
   /* Read the contents of a file removing the trailing \n