nixos-config/overlays/util.nix

20 lines
683 B
Nix
Raw Normal View History

2024-01-12 15:59:57 +01:00
self: super: {
util = rec {
dirEntries = path: builtins.attrNames (builtins.readDir path);
2024-03-18 08:56:51 +01:00
mapHosts = f: builtins.map f (dirEntries ../hosts/x86_64-linux);
mapHostAttrs = key_f: val_f:
builtins.listToAttrs (mapHosts (host: {
name = key_f host;
value = val_f host;
}));
mapObjKeys = obj: f: builtins.map f (builtins.attrNames obj);
mapKeys = obj: f: builtins.map f obj;
nixFilesIn = path:
builtins.map (e: import (path + /${e}))
(builtins.filter (x: (builtins.match ".*\\.nix$" x) != null)
(dirEntries path));
without = exclusions: list:
builtins.filter (x: !builtins.elem x exclusions) list;
};
2024-01-12 15:59:57 +01:00
}