mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-06 03:50:15 +00:00
move inherits and add attrset for imports
This commit is contained in:
16
hosts/default.nix
Normal file
16
hosts/default.nix
Normal file
@ -0,0 +1,16 @@
|
||||
# Return a list of all hosts
|
||||
|
||||
{ lib, ... }:
|
||||
|
||||
lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||||
# Get only files ending in default.nix
|
||||
(builtins.filter (name: lib.hasSuffix "default.nix" name))
|
||||
# Import each host function
|
||||
map
|
||||
(file: {
|
||||
name = builtins.baseNameOf (builtins.dirOf file);
|
||||
value = import file;
|
||||
})
|
||||
# Convert to an attrset of hostname -> host function
|
||||
(builtins.listToAttrs)
|
||||
]
|
Reference in New Issue
Block a user