fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Thiago Kenji Okadalib: remove top-level `with lib`3ccddfc4

master
721 B23 linesraw
1{ lib }:
2
3let
4  inherit (lib)
5    genList length lowerChars replaceStrings stringToCharacters upperChars;
6in {
7  # Figures out a valid Nix store name for the given path.
8  storeFileName = path:
9    let
10      # All characters that are considered safe. Note "-" is not
11      # included to avoid "-" followed by digit being interpreted as a
12      # version.
13      safeChars = [ "+" "." "_" "?" "=" ] ++ lowerChars ++ upperChars
14        ++ stringToCharacters "0123456789";
15
16      empties = l: genList (x: "") (length l);
17
18      unsafeInName =
19        stringToCharacters (replaceStrings safeChars (empties safeChars) path);
20
21      safeName = replaceStrings unsafeInName (empties unsafeInName) path;
22    in "hm_" + safeName;
23}