use nixosConfigurations and colmena combined. TODO check deployment

This commit is contained in:
pazpi 2024-08-27 17:48:32 +02:00
parent de3cd75244
commit fe8045ee55

170
flake.nix
View file

@ -38,93 +38,109 @@
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
myModule = {
imports = [ ./modules ];
};
proxmoxModule = {
imports = [
"${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
./modules/virtualisation/proxmox.nix
];
};
in
{
# used with: `nix fmt`
formatter.${system} = pkgs.nixfmt-rfc-style;
colmena = {
meta = {
nixpkgs = pkgs;
specialArgs = {
inherit inputs;
};
nixosConfigurations.deadbeef = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
defaults = {
imports = [
"${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
./modules
];
};
# childnixos = {
# deployment = {
# targetHost = "10.233.244.63";
# targetPort = 22;
# targetUser = "root";
# };
# imports = [ ./lxc-nix/configuration.nix ];
# };
arr = {
deployment = {
targetHost = "192.168.1.189";
targetPort = 22;
targetUser = "root";
};
imports = [ ./hosts/arr ];
};
modules = [
myModule
./hosts/deadbeef
];
};
nixosConfigurations =
let
mkNixosConfiguration =
name: extraModules:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
{
networking.hostName = name;
nixpkgs.overlays = [ (_: _: { nixfiles = self.packages.${system}; }) ];
# sops.defaultSopsFile = ./hosts + "/${name}" + /secrets.yaml;
}
./modules
(./hosts + "/${name}")
# (./hosts + "/${name}" + /hardware.nix)
# sops-nix.nixosModules.sops
] ++ extraModules;
};
in
{
deadbeef = mkNixosConfiguration "deadbeef" [ ];
# nyarlathotep = mkNixosConfiguration "nyarlathotep" [ "${nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
nixosConfigurations.arr = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
myModule
proxmoxModule
./hosts/arr
];
};
colmena =
{
meta = {
description = "pazpi.top infrastructure";
nixpkgs = import nixpkgs { inherit system; };
};
}
// builtins.mapAttrs (name: value: {
nixpkgs.system = value.config.nixpkgs.system;
imports = value._module.args.modules;
deployment = {
targetHost = "${name}.nixos.org";
};
}) self.nixosConfigurations;
# colmena = {
# meta = {
# nixpkgs = pkgs;
# specialArgs = {
# inherit inputs;
# };
# };
# defaults = {
# imports = [
# "${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
# ./modules
# ./modules/virtualisation/proxmox.nix
# ];
# };
# # childnixos = {
# # deployment = {
# # targetHost = "10.233.244.63";
# # targetPort = 22;
# # targetUser = "root";
# # };
# # imports = [ ./lxc-nix/configuration.nix ];
# # };
# arr = {
# deployment = {
# targetHost = "192.168.1.189";
# targetPort = 22;
# targetUser = "pazpi";
# };
# time.timeZone = "Europe/Rome";
# imports = [ ./hosts/arr ];
# };
# };
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
agenix.packages.${system}.agenix
colmena.packages.${system}.colmena
];
};
};
# nixosConfigurations = {
# deadbeef = nixpkgs.lib.nixosSystem {
# # inherit system;
# system = "x86_64-linux";
# specialArgs = { inherit inputs; };
# modules = [
# {
# networking.hostName = "deadbeef";
# nixpkgs.overlays = [ (_: _: { nixfiles = self.packages."x86_64-linux"; }) ];
# }
# ./hosts/deadbeef
# ];
# };
# };
}