nix-infra/hive.nix

61 lines
1.7 KiB
Nix
Raw Normal View History

2024-04-21 19:00:58 +00:00
{ inputs, self, lib, ... }:
let
inherit (inputs) nixpkgs nixpkgs-unstable;
inherit (self) outputs;
pkgs = import nixpkgs { system = "x86_64-linux"; };
2024-05-15 11:22:46 +00:00
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; config.allowUnfree = true; };
2024-04-21 19:00:58 +00:00
in
{
flake = rec {
colmena =
let
hosts = lib.genAttrs (builtins.attrNames (builtins.readDir ./hosts)) (name: { });
in
{
meta = {
description = "All my NixoS machines";
specialArgs = {
inherit inputs outputs pkgs-unstable;
2024-05-04 10:03:59 +00:00
flake = self;
2024-04-21 19:00:58 +00:00
nodes = colmenaHive.nodes;
};
nixpkgs = pkgs;
};
defaults = { lib, config, name, nodes, ... }: {
2024-05-04 10:03:59 +00:00
imports = [
./hosts/${name}
./profiles/base
(import ./overlays)
inputs.home-manager.nixosModules.home-manager
2024-06-05 16:16:21 +00:00
inputs.impermanence.nixosModules.impermanence
2024-05-04 10:03:59 +00:00
] ++ builtins.attrValues self.nixosModules;
2024-04-21 19:00:58 +00:00
config = {
networking.hostName = name;
networking.domain = "cherrykitten.xyz";
2024-05-04 10:03:59 +00:00
deployment = {
2024-06-01 13:19:39 +00:00
allowLocalDeployment = true;
2024-05-04 10:03:59 +00:00
targetUser = lib.mkDefault "sammy";
tags = [ pkgs.stdenv.hostPlatform.system ];
};
2024-04-21 19:00:58 +00:00
home-manager.extraSpecialArgs = {
inherit inputs outputs pkgs-unstable;
2024-05-04 10:03:59 +00:00
flake = self;
2024-04-21 19:00:58 +00:00
};
};
};
} // hosts;
colmenaHive = inputs.colmena.lib.makeHive colmena;
nixosConfigurations = {
iso = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ inputs.home-manager.nixosModules.home-manager ./profiles/iso ];
};
} // colmenaHive.nodes;
};
}