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-17 17:32:27 -08:00
outputs = { self, nixpkgs, fudo-home, fudo-pkgs, fudo-secrets, ... }: {
nixosConfigurations = let
2021-09-29 17:55:13 -07:00
lib = nixpkgs.lib;
hostlib = import ./lib/hosts.nix { inherit lib; };
2021-11-17 17:32:27 -08:00
nixos-hosts = lib.filterAttrs (hostname: hostOpts:
2021-09-29 17:55:13 -07:00
hostOpts.nixos-system) (hostlib.base-host-config ./config/hosts);
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 17:32:27 -08:00
in lib.mapAttrs (hostname: hostOpts: let
2021-09-29 17:55:13 -07:00
system = hostOpts.arch;
2021-11-17 17:32:27 -08:00
pkgs = pkgs-for system;
lib = pkgs.lib;
site = hostOpts.site;
domain = hostOpts.domain;
profile = hostOpts.profile;
build-seed =
builtins.readFile fudo-secrets.build-seed;
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 = {
instance = {
inherit hostname build-timestamp build-seed;
};
};
2021-09-29 17:55:13 -07:00
})
];
2021-11-17 17:32:27 -08:00
}) nixos-hosts;
};
}