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

154
flake.nix
View file

@ -38,93 +38,109 @@
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
myModule = {
imports = [ ./modules ];
};
proxmoxModule = {
imports = [
"${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
./modules/virtualisation/proxmox.nix
];
};
in in
{ {
# used with: `nix fmt` # used with: `nix fmt`
formatter.${system} = pkgs.nixfmt-rfc-style; formatter.${system} = pkgs.nixfmt-rfc-style;
colmena = { nixosConfigurations.deadbeef = nixpkgs.lib.nixosSystem {
meta = {
nixpkgs = pkgs;
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 ];
};
};
nixosConfigurations =
let
mkNixosConfiguration =
name: extraModules:
nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };
modules = [ modules = [
myModule
./hosts/deadbeef
];
};
nixosConfigurations.arr = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
myModule
proxmoxModule
./hosts/arr
];
};
colmena =
{ {
networking.hostName = name; meta = {
nixpkgs.overlays = [ (_: _: { nixfiles = self.packages.${system}; }) ]; description = "pazpi.top infrastructure";
# sops.defaultSopsFile = ./hosts + "/${name}" + /secrets.yaml; nixpkgs = import nixpkgs { inherit system; };
};
} }
./modules // builtins.mapAttrs (name: value: {
(./hosts + "/${name}") nixpkgs.system = value.config.nixpkgs.system;
# (./hosts + "/${name}" + /hardware.nix) imports = value._module.args.modules;
# sops-nix.nixosModules.sops deployment = {
] ++ extraModules; targetHost = "${name}.nixos.org";
};
in
{
deadbeef = mkNixosConfiguration "deadbeef" [ ];
# nyarlathotep = mkNixosConfiguration "nyarlathotep" [ "${nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
};
}; };
}) self.nixosConfigurations;
# nixosConfigurations = { # colmena = {
# meta = {
# nixpkgs = pkgs;
# specialArgs = {
# inherit inputs;
# };
# };
# deadbeef = nixpkgs.lib.nixosSystem { # defaults = {
# # inherit system; # imports = [
# system = "x86_64-linux"; # "${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
# specialArgs = { inherit inputs; }; # ./modules
# ./modules/virtualisation/proxmox.nix
# modules = [
# {
# networking.hostName = "deadbeef";
# nixpkgs.overlays = [ (_: _: { nixfiles = self.packages."x86_64-linux"; }) ];
# }
# ./hosts/deadbeef
# ]; # ];
# };
# # 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
];
};
};
} }