2025-02-08 20:14:54 -05:00
|
|
|
# Return a list of all NixOS hosts
|
|
|
|
|
|
|
|
{ nixpkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
in
|
|
|
|
|
|
|
|
lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
|
|
|
# Get only files ending in default.nix
|
|
|
|
(builtins.filter (name: lib.hasSuffix "default.nix" name))
|
2025-02-17 14:05:23 -05:00
|
|
|
# Remove this file
|
|
|
|
(builtins.filter (name: name != ./default.nix))
|
2025-02-08 20:14:54 -05:00
|
|
|
# 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)
|
|
|
|
]
|