Trying out a seperate hosts flake

This commit is contained in:
2021-08-09 14:14:00 -07:00
parent ee77c14b0e
commit c3fe6c59e3
2 changed files with 37 additions and 14 deletions
+6 -13
View File
@@ -3,24 +3,17 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.05";
hosts.url = "path:../fudo-hosts";
home-manager.url = "github:nix-community/home-manager/release-21.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, home-manager, ... }:
outputs = { nixpkgs, hosts, home-manager, ... }:
let
hosts-path = ./config/hosts;
lib = nixpkgs.lib;
is-nix-file = filename: type: (builtins.match ".+.nix$" filename) != null;
is-regular-file = filename: type: type == "regular" || type == "link";
hostname-from-file = filename:
builtins.replaceStrings [ ".nix" ] [ "" ] filename;
hosts = map hostname-from-file (lib.attrNames (lib.filterAttrs is-nix-file
(lib.filterAttrs is-regular-file (builtins.readDir hosts-path))));
hostsOpts = lib.listToAttrs (hostname:
lib.nameValuePair hostname (import hosts-path + "/${hostname}.nix"));
pkgs = import nixpkgs { };
lib = nixpkgs.lib;
in {
nixConfigurations = lib.mapAttrs (hostname: hostOpts:
@@ -34,6 +27,6 @@
include-secrets = true;
})
];
}) hostsOpts;
}) hosts.host-configs;
};
}