summaryrefslogtreecommitdiff
path: root/modules/fonts/default.nix
diff options
context:
space:
mode:
authorPiotr Limanowski <piotr@codearsonist.com>2018-10-04 13:46:28 +0200
committerPiotr Limanowski <piotr@codearsonist.com>2018-10-04 13:48:57 +0200
commit397d2637e9280ff3459534e8b81fd1ffdcb365df (patch)
tree121dcd402f5d006983671a76c3c534c397eaa086 /modules/fonts/default.nix
parent8fe33a584eb2844b179d83c627c369383fbad9e9 (diff)
looks for fonts with both otf and ttf extensions
Diffstat (limited to 'modules/fonts/default.nix')
-rw-r--r--modules/fonts/default.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix
index ed65e8c..75738fe 100644
--- a/modules/fonts/default.nix
+++ b/modules/fonts/default.nix
@@ -9,9 +9,13 @@ let
home = readDir path;
list = mapAttrsToList (name: type:
let newPath = "${path}/${name}";
- in if (type == "directory" || type == "symlink") && !(hasSuffix ".ttf" name) then readDirsRec newPath else [ newPath ]) home;
+ in if (type == "directory" || type == "symlink") && !(isFont name) then readDirsRec newPath else [ newPath ]) home;
in flatten list;
- fontFiles = dir: filter (name: hasSuffix ".ttf" name) (readDirsRec dir);
+ isFont = name: let
+ fontExt = [ ".ttf" ".otf" ];
+ hasExt = exts: name: foldl' (acc: ext: (hasSuffix ext name) || acc) false exts;
+ in hasExt fontExt name;
+ fontFiles = dir: filter isFont (readDirsRec dir);
print = font: "ln -fn '${font}' '/Library/Fonts/${baseNameOf font}'";
in concatMapStringsSep "\n" print (fontFiles dir);
in {