nixos-config/flake.nix

75 lines
1.9 KiB
Nix
Raw Normal View History

{
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";
fudo-pkgs.url = "path:/state/nixops/fudo-pkgs";
2021-09-29 17:55:13 -07:00
fudo-secrets.url = "path:/state/secrets";
};
2021-11-18 12:00:49 -08:00
outputs = { self, nixpkgs, fudo-home, fudo-pkgs, fudo-secrets, ... }: let
hostlib = import ./lib/hosts.nix { lib = nixpkgs.lib; };
fudo-nix-hosts = nixpkgs.lib.filterAttrs (hostname: hostOpts:
hostOpts.nixos-system) (hostlib.base-host-config ./config/hosts);
in {
fudoHosts = fudo-nix-hosts;
2021-09-29 17:55:13 -07:00
2021-11-18 12:00:49 -08:00
nixosConfigurations = let
2021-09-29 17:55:13 -07:00
build-timestamp = self.sourceInfo.lastModified;
2021-11-17 17:32:27 -08:00
pkgs-for = arch: import nixpkgs {
system = arch;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssh-with-gssapi-8.4p1"
];
};
overlays = [
2021-11-17 17:32:27 -08:00
fudo-pkgs.overlay
2021-10-04 12:23:46 -07:00
(import ./lib/overlay.nix)
];
};
2021-11-17 22:12:49 -08:00
in nixpkgs.lib.mapAttrs (hostname: hostOpts: let
2021-09-29 17:55:13 -07:00
system = hostOpts.arch;
2021-11-17 17:32:27 -08:00
site = hostOpts.site;
domain = hostOpts.domain;
profile = hostOpts.profile;
in nixpkgs.lib.nixosSystem {
inherit system;
2021-09-29 17:55:13 -07:00
2021-11-17 17:32:27 -08:00
modules = let
config-path = ./config;
in [
2021-10-01 12:52:57 -07:00
fudo-home.nixosModule
2021-09-29 18:44:33 -07:00
fudo-secrets.nixosModule
2021-11-17 17:32:27 -08:00
./lib
./config
(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)
({ config, ... }: {
2021-11-17 17:32:27 -08:00
config = {
instance = {
inherit hostname build-timestamp;
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-17 17:32:27 -08:00
};
2021-09-29 17:55:13 -07:00
})
];
2021-11-18 12:00:49 -08:00
}) fudo-nix-hosts;
};
}