mirror of
https://github.com/nmasur/dotfiles
synced 2025-02-23 07:22:04 +00:00
23 lines
525 B
Nix
23 lines
525 B
Nix
# 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))
|
|
# Remove this file
|
|
(builtins.filter (name: name != ./default.nix))
|
|
# 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)
|
|
]
|