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