refactor(dotfiles): share Nix file discovery
This commit was merged in pull request #101.
This commit is contained in:
@@ -2,20 +2,14 @@
|
||||
hosts,
|
||||
lib,
|
||||
root,
|
||||
util,
|
||||
}:
|
||||
let
|
||||
definitions =
|
||||
lib.mapAttrs'
|
||||
(
|
||||
name: _type:
|
||||
let
|
||||
path = root + "/${name}";
|
||||
in
|
||||
lib.nameValuePair (registryName name) (mkRegistry path)
|
||||
)
|
||||
(
|
||||
lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name) (builtins.readDir root)
|
||||
);
|
||||
definitions = lib.listToAttrs (
|
||||
map (path: lib.nameValuePair (registryName (builtins.baseNameOf path)) (mkRegistry path)) (
|
||||
util.collectNixFiles root
|
||||
)
|
||||
);
|
||||
|
||||
registryName = fileName: lib.removeSuffix ".nix" fileName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user