2021-09-24 11:31:56 -07:00
|
|
|
{
|
|
|
|
description = "Fudo Host Configuration";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "nixpkgs/nixos-21.05";
|
2021-09-29 17:55:13 -07:00
|
|
|
|
2021-11-17 17:32:27 -08:00
|
|
|
fudo-home.url = "path:/state/nixops/fudo-home";
|
|
|
|
|
2021-11-22 10:17:44 -08:00
|
|
|
fudo-entities.url = "path:/state/fudo-entities";
|
|
|
|
|
|
|
|
fudo-lib.url = "path:/state/fudo-lib";
|
|
|
|
|
2021-11-17 17:32:27 -08:00
|
|
|
fudo-pkgs.url = "path:/state/nixops/fudo-pkgs";
|
2021-09-29 17:55:13 -07:00
|
|
|
|
|
|
|
fudo-secrets.url = "path:/state/secrets";
|
2021-09-24 11:31:56 -07:00
|
|
|
};
|
|
|
|
|
2021-11-22 10:17:44 -08:00
|
|
|
outputs = { self,
|
|
|
|
nixpkgs,
|
|
|
|
fudo-home,
|
|
|
|
fudo-lib,
|
|
|
|
fudo-entities,
|
|
|
|
fudo-pkgs,
|
|
|
|
fudo-secrets,
|
|
|
|
... }:
|
2021-11-19 10:26:10 -08:00
|
|
|
with nixpkgs.lib;
|
|
|
|
let
|
|
|
|
sys-lib = import ./lib/system.nix { lib = nixpkgs.lib; };
|
2021-11-18 12:00:49 -08:00
|
|
|
|
2021-11-22 10:17:44 -08:00
|
|
|
fudo-nix-hosts = filterAttrs
|
2021-11-19 10:26:10 -08:00
|
|
|
(hostname: hostOpts: hostOpts.nixos-system)
|
2021-11-22 10:17:44 -08:00
|
|
|
(fudo-entities.entities.hosts);
|
2021-09-29 17:55:13 -07:00
|
|
|
|
2021-11-22 10:17:44 -08:00
|
|
|
fudo-networks = fudo-entities.entities.networks;
|
2021-11-17 17:32:27 -08:00
|
|
|
|
2021-11-22 10:17:44 -08:00
|
|
|
pkgs-for = arch: import nixpkgs {
|
|
|
|
system = arch;
|
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
permittedInsecurePackages = [
|
|
|
|
"openssh-with-gssapi-8.4p1"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
overlays = [
|
|
|
|
fudo-lib.overlay
|
|
|
|
fudo-pkgs.overlay
|
2021-09-24 11:31:56 -07:00
|
|
|
];
|
|
|
|
};
|
2021-11-22 10:17:44 -08:00
|
|
|
in {
|
2021-11-19 10:26:10 -08:00
|
|
|
nixosConfigurations = let
|
|
|
|
in mapAttrs (hostname: hostOpts: let
|
|
|
|
system = hostOpts.arch;
|
|
|
|
site = hostOpts.site;
|
|
|
|
domain = hostOpts.domain;
|
|
|
|
profile = hostOpts.profile;
|
|
|
|
in nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
|
|
|
|
modules = let
|
|
|
|
config-path = ./config;
|
|
|
|
in [
|
|
|
|
fudo-home.nixosModule
|
|
|
|
fudo-secrets.nixosModule
|
2021-11-22 10:17:44 -08:00
|
|
|
fudo-lib.nixosModule
|
2021-11-19 10:26:10 -08:00
|
|
|
|
|
|
|
({ config, ... }: let
|
|
|
|
network-hosts = config.fudo.networks.${domain}.hosts;
|
|
|
|
in {
|
|
|
|
imports = [
|
2021-11-22 10:17:44 -08:00
|
|
|
fudo-entities.nixosModule
|
2021-11-19 10:26:10 -08:00
|
|
|
(config-path + /hardware/${hostname}.nix)
|
|
|
|
(config-path + /host-config/${hostname}.nix)
|
|
|
|
(config-path + /profile-config/${profile}.nix)
|
|
|
|
(config-path + /domain-config/${domain}.nix)
|
|
|
|
(config-path + /site-config/${site}.nix)
|
|
|
|
];
|
2021-11-17 17:32:27 -08:00
|
|
|
instance = {
|
2021-11-22 10:17:44 -08:00
|
|
|
inherit hostname;
|
2021-11-18 09:51:41 -08:00
|
|
|
build-seed = builtins.readFile
|
|
|
|
config.fudo.secrets.files.build-seed;
|
2021-11-17 17:32:27 -08:00
|
|
|
};
|
2021-11-17 22:12:49 -08:00
|
|
|
nixpkgs.pkgs = pkgs-for system;
|
2021-11-19 10:26:10 -08:00
|
|
|
})
|
|
|
|
];
|
|
|
|
}) fudo-nix-hosts;
|
|
|
|
};
|
2021-09-24 11:31:56 -07:00
|
|
|
}
|