aboutsummaryrefslogtreecommitdiff
path: root/flake/hosts.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--flake/hosts.nix41
1 files changed, 27 insertions, 14 deletions
diff --git a/flake/hosts.nix b/flake/hosts.nix
index ef2b28b..b2dac30 100644
--- a/flake/hosts.nix
+++ b/flake/hosts.nix
@@ -15,6 +15,7 @@ let
mkIf
nixosSystem
readDir
+ replaceStrings
substring
;
@@ -32,25 +33,37 @@ let
mapHosts = foldl' (
hosts: system:
hosts
- // (mapAttrs' (name: _: {
- inherit name;
- value = {
- inherit system;
- hostconf = "${self}/machines/nixos/${system}/${name}";
- };
- }) (builtins.readDir "${self}/machines/nixos/${system}"))
+ // (mapAttrs' (
+ filename: _:
+ let
+ name = replaceStrings [ ".nix" ] [ "" ] filename;
+ in
+ {
+ inherit name;
+ value = {
+ inherit system;
+ hostconf = "${self}/machines/nixos/${system}/${filename}";
+ };
+ }
+ ) (builtins.readDir "${self}/machines/nixos/${system}"))
) { };
mapMacs = foldl' (
hosts: system:
hosts
- // (mapAttrs' (name: _: {
- inherit name;
- value = {
- inherit system;
- hostconf = "${self}/machines/darwin/${system}/${name}";
- };
- }) (builtins.readDir "${self}/machines/darwin/${system}"))
+ // (mapAttrs' (
+ filename: _:
+ let
+ name = replaceStrings [ ".nix" ] [ "" ] filename;
+ in
+ {
+ inherit name;
+ value = {
+ inherit system;
+ hostconf = "${self}/machines/darwin/${system}/${filename}";
+ };
+ }
+ ) (builtins.readDir "${self}/machines/darwin/${system}"))
) { };
defaultModules = [