diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-12-31 09:47:26 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-12-31 09:53:02 +0100 |
commit | f9f6f41bff2213e199bded515e9b66d1e5c4d7dd (patch) | |
tree | 29c5a75228e31f305f42c5b761709a186e406776 /lib/strings.nix | |
parent | bbcf127c7c9029cba43493d7d25a9d1c65d59152 (diff) | |
parent | 468f698f609e123bb0ffae67181d07ac99eb2204 (diff) | |
download | nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.tar nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.tar.gz nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.tar.bz2 nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.tar.lz nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.tar.xz nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.tar.zst nixlib-f9f6f41bff2213e199bded515e9b66d1e5c4d7dd.zip |
Merge branch 'master' into closure-size
TODO: there was more significant refactoring of qtbase and plasma 5.5 on master, and I'm deferring pointing to correct outputs to later.
Diffstat (limited to 'lib/strings.nix')
-rw-r--r-- | lib/strings.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/strings.nix b/lib/strings.nix index 96c087e8da0e..9a2f3c432ca3 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -237,4 +237,19 @@ rec { then may_be_int else throw "Could not convert ${str} to int."; + # Read a list of paths from `file', relative to the `rootPath'. Lines + # beginning with `#' are treated as comments and ignored. Whitespace + # is significant. + readPathsFromFile = rootPath: file: + let + root = toString rootPath; + lines = + builtins.map (lib.removeSuffix "\n") + (lib.splitString "\n" (builtins.readFile file)); + removeComments = lib.filter (line: !(lib.hasPrefix "#" line)); + relativePaths = removeComments lines; + absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths; + in + absolutePaths; + } |