2021-09-24 11:31:56 -07:00
|
|
|
{
|
|
|
|
description = "Fudo Host Configuration";
|
|
|
|
|
|
|
|
inputs = {
|
2022-06-01 13:57:58 -07:00
|
|
|
nixpkgs.url = "nixpkgs/nixos-22.05";
|
2021-09-29 17:55:13 -07:00
|
|
|
|
2022-03-16 09:49:35 -07:00
|
|
|
fudo-home = {
|
|
|
|
url = "git+https://git.fudo.org/fudo-nix/home.git";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-11-17 17:32:27 -08:00
|
|
|
|
2021-11-29 16:03:38 -08:00
|
|
|
# This MUST be a clean git repo, because we use the timestamp.
|
2021-11-28 12:39:03 -08:00
|
|
|
fudo-entities = {
|
2021-11-30 10:52:00 -08:00
|
|
|
url = "git+https://git.fudo.org/fudo-nix/entities.git";
|
2021-11-28 12:39:03 -08:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-11-22 10:17:44 -08:00
|
|
|
|
2021-11-28 12:39:03 -08:00
|
|
|
fudo-lib = {
|
2021-12-10 18:47:20 -08:00
|
|
|
#url = "git+https://git.fudo.org/fudo-nix/lib.git";
|
|
|
|
url = "path:/state/fudo-lib";
|
2021-11-28 12:39:03 -08:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-11-22 10:17:44 -08:00
|
|
|
|
2021-11-30 10:52:00 -08:00
|
|
|
fudo-pkgs.url = "git+https://git.fudo.org/fudo-nix/pkgs.git";
|
2021-09-29 17:55:13 -07:00
|
|
|
|
|
|
|
fudo-secrets.url = "path:/state/secrets";
|
2021-12-18 12:10:42 -08:00
|
|
|
|
|
|
|
chute.url = "git+https://git.fudo.org/chute/chute.git?ref=stable";
|
|
|
|
|
|
|
|
chuteUnstable.url = "git+https://git.fudo.org/chute/chute.git?ref=master";
|
2022-03-16 09:49:35 -07:00
|
|
|
|
2022-07-10 20:46:03 -07:00
|
|
|
pricebot.url = "git+https://git.fudo.org/fudo-public/pricebot.git";
|
|
|
|
|
2022-03-16 09:49:35 -07:00
|
|
|
nixpkgsUnstable.url = "nixpkgs/nixos-unstable";
|
2022-06-01 13:57:58 -07:00
|
|
|
|
2022-07-10 20:46:03 -07:00
|
|
|
nixpkgs2111.url = "nixpkgs/nixos-21.11";
|
|
|
|
|
|
|
|
wallfly.url = "git+https://git.fudo.org/fudo-public/wallfly.git";
|
2021-09-24 11:31:56 -07:00
|
|
|
};
|
|
|
|
|
2022-06-01 13:57:58 -07:00
|
|
|
outputs = { self, nixpkgs, fudo-home, fudo-lib, fudo-entities, fudo-pkgs
|
2022-07-10 20:46:03 -07:00
|
|
|
, fudo-secrets, chute, chuteUnstable, nixpkgsUnstable, nixpkgs2111, pricebot
|
|
|
|
, wallfly, ... }@inputs:
|
2021-11-19 10:26:10 -08:00
|
|
|
with nixpkgs.lib;
|
|
|
|
let
|
2022-06-01 13:57:58 -07:00
|
|
|
fudo-nixos-hosts = filterAttrs (hostname: hostOpts: hostOpts.nixos-system)
|
|
|
|
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
|
|
|
|
2022-06-01 13:57:58 -07:00
|
|
|
unstable-for = arch:
|
|
|
|
import nixpkgsUnstable {
|
|
|
|
system = arch;
|
2022-07-10 20:46:03 -07:00
|
|
|
config.allowUnfree = true;
|
2022-03-16 09:49:35 -07:00
|
|
|
};
|
2022-06-01 13:57:58 -07:00
|
|
|
|
|
|
|
pkgs-for = arch:
|
|
|
|
let unstable = unstable-for arch;
|
|
|
|
in import nixpkgs {
|
|
|
|
system = arch;
|
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
permittedInsecurePackages = [ "openssh-with-gssapi-8.4p1" ];
|
|
|
|
};
|
|
|
|
overlays = [
|
|
|
|
fudo-lib.overlay
|
|
|
|
fudo-pkgs.overlay
|
|
|
|
(final: prev: {
|
|
|
|
chute = chute.packages.${arch}.chute;
|
|
|
|
chuteUnstable = chuteUnstable.packages.${arch}.chute;
|
|
|
|
})
|
2022-07-10 20:46:03 -07:00
|
|
|
(final: prev: {
|
|
|
|
pkgs2111 = import nixpkgs2111 {
|
|
|
|
system = arch;
|
|
|
|
config.allowUnfree = true;
|
|
|
|
};
|
|
|
|
pkgsUnstable = unstable;
|
|
|
|
})
|
2022-06-01 13:57:58 -07:00
|
|
|
(final: prev: { nyxt = unstable.nyxt; })
|
2021-11-22 10:17:44 -08:00
|
|
|
];
|
|
|
|
};
|
2021-11-29 16:03:38 -08:00
|
|
|
|
2022-06-01 13:57:58 -07:00
|
|
|
latest-modified-timestamp = head (sort (a: b: a > b)
|
|
|
|
(map (input: toInt input.lastModifiedDate)
|
|
|
|
(filter (input: hasAttr "lastModifiedDate" input)
|
|
|
|
(attrValues inputs))));
|
|
|
|
|
|
|
|
concat-timestamp = timestamp: toInt (substring 0 10 (toString timestamp));
|
|
|
|
|
|
|
|
common-host-config = hostname: hostOpts:
|
|
|
|
let
|
|
|
|
config-dir = ./config;
|
|
|
|
build-timestamp = concat-timestamp latest-modified-timestamp;
|
|
|
|
in { config, ... }: {
|
|
|
|
imports = [
|
|
|
|
fudo-home.nixosModule
|
|
|
|
fudo-secrets.nixosModule
|
|
|
|
fudo-lib.nixosModule
|
|
|
|
fudo-entities.nixosModule
|
2022-07-10 20:46:03 -07:00
|
|
|
pricebot.nixosModule
|
|
|
|
wallfly.nixosModule
|
2022-06-01 13:57:58 -07:00
|
|
|
|
|
|
|
./config
|
|
|
|
(config-dir + "/hardware/${hostname}.nix")
|
|
|
|
(config-dir + "/host-config/${hostname}.nix")
|
|
|
|
(config-dir + "/profile-config/${hostOpts.profile}.nix")
|
|
|
|
(config-dir + "/domain-config/${hostOpts.domain}.nix")
|
|
|
|
(config-dir + "/site-config/${hostOpts.site}.nix")
|
|
|
|
];
|
2022-03-16 09:49:35 -07:00
|
|
|
|
2022-06-01 13:57:58 -07:00
|
|
|
config = let pkgs = pkgs-for hostOpts.arch;
|
|
|
|
in {
|
|
|
|
instance = let
|
|
|
|
build-seed =
|
|
|
|
builtins.readFile config.fudo.secrets.files.build-seed;
|
|
|
|
in { inherit hostname build-timestamp build-seed; };
|
|
|
|
|
|
|
|
environment.etc.nixos-live.source = ./.;
|
|
|
|
|
|
|
|
nix = {
|
|
|
|
registry = {
|
|
|
|
nixpkgs.flake = nixpkgs;
|
|
|
|
fudo-nixos.flake = self;
|
|
|
|
fudo-entities.flake = fudo-entities;
|
|
|
|
fudo-lib.flake = fudo-lib;
|
|
|
|
fudo-pkgs.flake = fudo-pkgs;
|
|
|
|
};
|
|
|
|
nixPath = let lib = nixpkgs.lib;
|
|
|
|
in lib.mkDefault (lib.mkBefore [ "nixpkgs=${nixpkgs}" ]);
|
2022-03-16 09:49:35 -07:00
|
|
|
};
|
2022-06-01 13:57:58 -07:00
|
|
|
|
|
|
|
nixpkgs.pkgs = pkgs;
|
2021-11-29 16:03:38 -08:00
|
|
|
};
|
2022-06-01 13:57:58 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
nixos-host-config = hostname: hostOpts:
|
|
|
|
let system = hostOpts.arch;
|
|
|
|
in nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [ (common-host-config hostname hostOpts) ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nixops-host-config = hostname: hostOpts:
|
|
|
|
let zone-hosts = fudo-entities.entities.zones.${hostOpts.domain}.hosts;
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
(common-host-config hostname hostOpts)
|
2021-11-29 16:03:38 -08:00
|
|
|
|
2022-06-01 13:57:58 -07:00
|
|
|
(_: {
|
|
|
|
config.deployment.targetHost =
|
|
|
|
zone-hosts.${hostname}.ipv4-address;
|
|
|
|
})
|
|
|
|
];
|
2021-11-29 16:03:38 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
nixosConfigurations = mapAttrs nixos-host-config fudo-nixos-hosts;
|
|
|
|
nixopsHostConfigurations = mapAttrs nixops-host-config fudo-nixos-hosts;
|
2021-11-19 10:26:10 -08:00
|
|
|
};
|
2021-09-24 11:31:56 -07:00
|
|
|
}
|