232 lines
6.8 KiB
Nix
232 lines
6.8 KiB
Nix
{
|
|
description = "A simple system flake using some Aux defaults";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager/release-24.05";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
microvm.url = "github:astro/microvm.nix";
|
|
microvm.inputs.nixpkgs.follows = "nixpkgs";
|
|
authentik-nix.url = "github:nix-community/authentik-nix";
|
|
agenix.url = "github:ryantm/agenix";
|
|
};
|
|
|
|
outputs = inputs@{ self, nixpkgs, home-manager, microvm, agenix, ... }:
|
|
let
|
|
system = "x86_64-linux";
|
|
username = "tbarnouin";
|
|
proxy_host = "192.168.1.40";
|
|
pgsql_host = "192.168.1.13";
|
|
in
|
|
{
|
|
nixosConfigurations = {
|
|
nixmox-curiosity = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
agenix.nixosModules.default
|
|
./hosts/nixmox-curiosity/configuration.nix
|
|
{
|
|
networking.hostName = "nixmox-curiosity";
|
|
}
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
home-manager.users.${username} = import ./hosts/nixmox-curiosity/home.nix;
|
|
}
|
|
microvm.nixosModules.host
|
|
{
|
|
microvm = {
|
|
autostart = [];
|
|
vms = {};
|
|
};
|
|
}
|
|
];
|
|
|
|
specialArgs = {
|
|
inherit inputs;
|
|
inherit username;
|
|
inherit proxy_host;
|
|
inherit pgsql_host;
|
|
inherit system;
|
|
};
|
|
};
|
|
nginx = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
|
"${inputs.self}/services"
|
|
{
|
|
networking.hostName = "nginx";
|
|
services.vm_nginx = {
|
|
enable = true;
|
|
};
|
|
services.ct = {
|
|
enable = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
forgejo-runner = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
agenix.nixosModules.default
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
|
"${inputs.self}/services"
|
|
{
|
|
networking.hostName = "forgejo-runner";
|
|
services.vm_forgejo = {
|
|
enable = true;
|
|
};
|
|
services.ct = {
|
|
enable = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
jellyfin = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
microvm.nixosModules.microvm
|
|
"${inputs.self}/systems"
|
|
"${inputs.self}/services"
|
|
{
|
|
services.vm_jellyfin = {
|
|
enable = true;
|
|
};
|
|
services.vm = {
|
|
enable = true;
|
|
hostname = "jellyfin";
|
|
vm_ip = "192.168.1.42";
|
|
vm_cpu = 4;
|
|
vm_mem = 8192;
|
|
macAddr = "02:00:00:00:00:42";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
redis = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
|
"${inputs.self}/services"
|
|
{
|
|
networking.hostName = "redis";
|
|
services.vm_redis = {
|
|
enable = true;
|
|
};
|
|
services.ct = {
|
|
enable = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
grafana-lxc = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
agenix.nixosModules.default
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
|
"${inputs.self}/services"
|
|
{
|
|
services.vm_grafana = {
|
|
enable = true;
|
|
vm_ip = "192.168.1.27";
|
|
proxy_ip = proxy_host;
|
|
pgsql_ip = pgsql_host;
|
|
};
|
|
services.ct = {
|
|
enable = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
grafana = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
microvm.nixosModules.microvm
|
|
"${inputs.self}/systems"
|
|
"${inputs.self}/services"
|
|
{
|
|
services.vm_grafana = {
|
|
enable = true;
|
|
proxy_ip = proxy_host;
|
|
pgsql_ip = pgsql_host;
|
|
};
|
|
services.vm = {
|
|
enable = true;
|
|
hostname = "grafana";
|
|
vm_ip = "192.168.1.20";
|
|
vm_cpu = 1;
|
|
vm_mem = 512;
|
|
macAddr = "02:00:00:00:00:20";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
netbox = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
microvm.nixosModules.microvm
|
|
"${inputs.self}/systems"
|
|
"${inputs.self}/services"
|
|
{
|
|
services.vm_netbox = {
|
|
enable = true;
|
|
};
|
|
services.vm = {
|
|
enable = true;
|
|
hostname = "netbox";
|
|
vm_ip = "192.168.1.45";
|
|
vm_cpu = 2;
|
|
vm_mem = 2048;
|
|
macAddr = "02:00:00:00:00:45";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
authentik = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
inputs.authentik-nix.nixosModules.default
|
|
{
|
|
services.authentik = {
|
|
enable = true;
|
|
environmentFile = "/run/secrets/authentik/authentik-env";
|
|
settings = {
|
|
disable_startup_analytics = true;
|
|
avatars = "initials";
|
|
};
|
|
};
|
|
services.vm_authentik = {
|
|
enable = true;
|
|
};
|
|
}
|
|
microvm.nixosModules.microvm
|
|
"${inputs.self}/systems"
|
|
"${inputs.self}/services"
|
|
{
|
|
microvm = {
|
|
volumes = [
|
|
{
|
|
mountPoint = "/media";
|
|
image = "/var/lib/microvms/authentik/media.img";
|
|
size = 2048;
|
|
}
|
|
];
|
|
};
|
|
services.vm = {
|
|
enable = true;
|
|
hostname = "authentik";
|
|
vm_ip = "192.168.1.25";
|
|
vm_cpu = 2;
|
|
vm_mem = 2048;
|
|
macAddr = "02:00:00:00:00:25";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|