40 lines
1.3 KiB
Nix
40 lines
1.3 KiB
Nix
{
|
|
description = "Fudo Host Configuration";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixos-21.05";
|
|
home-manager.url = "github:nix-community/home-manager/release-21.05";
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
outputs = { nixpkgs, 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 { };
|
|
|
|
in {
|
|
nixConfigurations = lib.mapAttrs (hostname: hostOpts:
|
|
lib.nixosSystem {
|
|
system = hostOpts.platform;
|
|
modules = [
|
|
(import ./initialize.nix {
|
|
hostname = hostname;
|
|
home-manager-package = home-manager;
|
|
pkgs = pkgs;
|
|
include-secrets = true;
|
|
})
|
|
];
|
|
}) hostsOpts;
|
|
};
|
|
}
|