Changes to nutmeg and flake.nix
This commit is contained in:
@@ -11,64 +11,92 @@
|
||||
fudo-secrets.url = "path:/state/secrets";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, fudo-home, fudo-pkgs, fudo-secrets, ... }: let
|
||||
hostlib = import ./lib/hosts.nix { lib = nixpkgs.lib; };
|
||||
outputs = { self, nixpkgs, fudo-home, fudo-pkgs, fudo-secrets, ... }:
|
||||
with nixpkgs.lib;
|
||||
let
|
||||
sys-lib = import ./lib/system.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;
|
||||
fudo-nix-hosts = nixpkgs.lib.filterAttrs
|
||||
(hostname: hostOpts: hostOpts.nixos-system)
|
||||
(sys-lib.hosts ./config/hosts);
|
||||
|
||||
nixosConfigurations = let
|
||||
fudo-networks = sys-lib.networks ./config/networks;
|
||||
in {
|
||||
fudoHosts = fudo-nix-hosts;
|
||||
|
||||
build-timestamp = self.sourceInfo.lastModified;
|
||||
fudoNetworks = fudo-networks;
|
||||
|
||||
pkgs-for = arch: import nixpkgs {
|
||||
system = arch;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
"openssh-with-gssapi-8.4p1"
|
||||
];
|
||||
};
|
||||
overlays = [
|
||||
fudo-pkgs.overlay
|
||||
(import ./lib/overlay.nix)
|
||||
nixosModule = {
|
||||
imports = [
|
||||
./lib
|
||||
];
|
||||
};
|
||||
in nixpkgs.lib.mapAttrs (hostname: hostOpts: let
|
||||
system = hostOpts.arch;
|
||||
site = hostOpts.site;
|
||||
domain = hostOpts.domain;
|
||||
profile = hostOpts.profile;
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = let
|
||||
config-path = ./config;
|
||||
in [
|
||||
fudo-home.nixosModule
|
||||
fudo-secrets.nixosModule
|
||||
./lib
|
||||
./config
|
||||
nixosConfigurations = let
|
||||
|
||||
(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, ... }: {
|
||||
build-timestamp = self.sourceInfo.lastModified;
|
||||
|
||||
pkgs-for = arch: import nixpkgs {
|
||||
system = arch;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
"openssh-with-gssapi-8.4p1"
|
||||
];
|
||||
};
|
||||
overlays = [
|
||||
fudo-pkgs.overlay
|
||||
(import ./lib/overlay.nix)
|
||||
];
|
||||
};
|
||||
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
|
||||
|
||||
({ config, ... }: let
|
||||
network-hosts = config.fudo.networks.${domain}.hosts;
|
||||
host-filesystem-keys =
|
||||
config.fudo.secrets.files.host-filesystem-keys;
|
||||
in {
|
||||
imports = [
|
||||
./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)
|
||||
];
|
||||
instance = {
|
||||
inherit hostname build-timestamp;
|
||||
build-seed = builtins.readFile
|
||||
config.fudo.secrets.files.build-seed;
|
||||
};
|
||||
|
||||
nixpkgs.pkgs = pkgs-for system;
|
||||
};
|
||||
})
|
||||
];
|
||||
}) fudo-nix-hosts;
|
||||
};
|
||||
# deployment = {
|
||||
# targetHost =
|
||||
# network-hosts.${hostname}.ipv4-address;
|
||||
|
||||
# keys = if (hasAttr hostname host-filesystem-keys) then
|
||||
# mapAttrs (secret: secret-file: {
|
||||
# keyFile = secret-file;
|
||||
# user = "root";
|
||||
# permissions = "0400";
|
||||
# }) host-filesystem-keys.${hostname}
|
||||
# else {};
|
||||
# };
|
||||
})
|
||||
];
|
||||
}) fudo-nix-hosts;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user