2024-09-09 10:48:56 +02:00
|
|
|
{
|
|
|
|
description = "A simple system flake using some Aux defaults";
|
|
|
|
|
|
|
|
inputs = {
|
2025-01-08 10:02:38 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
2024-09-09 10:48:56 +02:00
|
|
|
home-manager = {
|
2025-01-08 10:02:38 +01:00
|
|
|
url = "github:nix-community/home-manager/release-24.11";
|
2024-09-09 10:48:56 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
microvm.url = "github:astro/microvm.nix";
|
|
|
|
microvm.inputs.nixpkgs.follows = "nixpkgs";
|
2024-09-13 10:32:18 +02:00
|
|
|
authentik-nix.url = "github:nix-community/authentik-nix";
|
2024-11-28 12:09:01 +01:00
|
|
|
agenix.url = "github:yaxitech/ragenix";
|
2024-09-09 10:48:56 +02:00
|
|
|
};
|
|
|
|
|
2024-10-23 13:10:45 +02:00
|
|
|
outputs = inputs@{ self, nixpkgs, home-manager, microvm, agenix, ... }:
|
2024-09-09 10:48:56 +02:00
|
|
|
let
|
2024-09-10 14:40:56 +02:00
|
|
|
system = "x86_64-linux";
|
|
|
|
username = "tbarnouin";
|
2024-09-13 10:32:18 +02:00
|
|
|
proxy_host = "192.168.1.40";
|
2024-09-25 13:36:18 +02:00
|
|
|
pgsql_host = "192.168.1.13";
|
2024-09-09 10:48:56 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosConfigurations = {
|
2024-09-17 18:24:38 +02:00
|
|
|
nixmox-curiosity = nixpkgs.lib.nixosSystem {
|
2024-09-09 10:48:56 +02:00
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-10-23 15:57:49 +02:00
|
|
|
agenix.nixosModules.default
|
2024-09-17 18:24:38 +02:00
|
|
|
./hosts/nixmox-curiosity/configuration.nix
|
2024-09-09 10:48:56 +02:00
|
|
|
{
|
2024-09-17 18:24:38 +02:00
|
|
|
networking.hostName = "nixmox-curiosity";
|
2024-09-09 10:48:56 +02:00
|
|
|
}
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
2024-09-17 18:24:38 +02:00
|
|
|
home-manager.users.${username} = import ./hosts/nixmox-curiosity/home.nix;
|
2024-09-09 10:48:56 +02:00
|
|
|
}
|
|
|
|
microvm.nixosModules.host
|
|
|
|
{
|
2024-09-09 15:19:57 +02:00
|
|
|
microvm = {
|
2024-10-23 15:59:37 +02:00
|
|
|
autostart = [];
|
|
|
|
vms = {};
|
2024-09-09 10:48:56 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2024-09-09 15:19:57 +02:00
|
|
|
|
2024-09-09 10:48:56 +02:00
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
inherit username;
|
2024-09-17 14:48:19 +02:00
|
|
|
inherit proxy_host;
|
2024-09-25 13:44:15 +02:00
|
|
|
inherit pgsql_host;
|
2024-09-17 14:48:19 +02:00
|
|
|
inherit system;
|
|
|
|
};
|
|
|
|
};
|
2024-09-09 10:48:56 +02:00
|
|
|
nginx = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-10-23 16:45:46 +02:00
|
|
|
agenix.nixosModules.default
|
2024-10-16 15:37:45 +02:00
|
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
2025-01-07 13:38:19 +01:00
|
|
|
"${inputs.self}/systems/minimalLXCConfig.nix"
|
2024-09-09 10:48:56 +02:00
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
2024-10-15 15:46:57 +02:00
|
|
|
networking.hostName = "nginx";
|
2024-09-09 10:48:56 +02:00
|
|
|
services.vm_nginx = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2025-01-07 13:38:19 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2025-01-07 13:55:31 +01:00
|
|
|
onlyoffice = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
|
|
|
agenix.nixosModules.default
|
|
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
|
|
|
"${inputs.self}/systems/minimalLXCConfig.nix"
|
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
|
|
|
networking.hostName = "onlyoffice";
|
|
|
|
services.vm_onlyoffice = {
|
|
|
|
enable = true;
|
2025-01-07 14:06:00 +01:00
|
|
|
pgsql_ip = pgsql_host;
|
2025-01-07 13:55:31 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2025-01-08 11:54:10 +01:00
|
|
|
# template = nixpkgs.lib.nixosSystem {
|
|
|
|
# inherit system;
|
|
|
|
# modules = [
|
|
|
|
# agenix.nixosModules.default
|
|
|
|
# "${inputs.self}/systems/minimalVMConfig.nix"
|
|
|
|
# {
|
|
|
|
# networking.hostName = "nixos";
|
|
|
|
# }
|
|
|
|
# ];
|
|
|
|
# };
|
2024-09-17 14:48:19 +02:00
|
|
|
jellyfin = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-10-23 16:45:46 +02:00
|
|
|
agenix.nixosModules.default
|
2024-09-17 14:48:19 +02:00
|
|
|
microvm.nixosModules.microvm
|
2025-01-07 13:38:19 +01:00
|
|
|
"${inputs.self}/systems/minimalVMConfig.nix"
|
2024-09-17 14:48:19 +02:00
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
|
|
|
services.vm_jellyfin = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-09-10 14:40:56 +02:00
|
|
|
redis = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-10-23 16:45:46 +02:00
|
|
|
agenix.nixosModules.default
|
2024-10-16 15:37:45 +02:00
|
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
2025-01-07 13:38:19 +01:00
|
|
|
"${inputs.self}/systems/minimalLXCConfig.nix"
|
2024-09-10 14:40:56 +02:00
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
2024-10-15 15:44:21 +02:00
|
|
|
networking.hostName = "redis";
|
2024-09-10 14:40:56 +02:00
|
|
|
services.vm_redis = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-10-23 15:52:46 +02:00
|
|
|
grafana-lxc = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
|
|
|
agenix.nixosModules.default
|
|
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
2025-01-07 13:38:19 +01:00
|
|
|
"${inputs.self}/systems/minimalLXCConfig.nix"
|
2024-10-23 15:52:46 +02:00
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
|
|
|
services.vm_grafana = {
|
|
|
|
enable = true;
|
|
|
|
vm_ip = "192.168.1.27";
|
|
|
|
proxy_ip = proxy_host;
|
|
|
|
pgsql_ip = pgsql_host;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-09-10 14:40:56 +02:00
|
|
|
grafana = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-10-23 16:45:46 +02:00
|
|
|
agenix.nixosModules.default
|
2024-09-10 14:40:56 +02:00
|
|
|
microvm.nixosModules.microvm
|
2025-01-07 13:38:19 +01:00
|
|
|
"${inputs.self}/systems/minimalMicrovmConfig.nix"
|
2024-09-10 14:40:56 +02:00
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
|
|
|
services.vm_grafana = {
|
|
|
|
enable = true;
|
2024-10-23 16:45:46 +02:00
|
|
|
vm_ip = "192.168.1.27";
|
2024-09-25 13:44:15 +02:00
|
|
|
proxy_ip = proxy_host;
|
|
|
|
pgsql_ip = pgsql_host;
|
2024-09-10 14:40:56 +02:00
|
|
|
};
|
2024-12-12 11:54:49 +01:00
|
|
|
services.micro_vm = {
|
2024-09-10 14:40:56 +02:00
|
|
|
enable = true;
|
|
|
|
hostname = "grafana";
|
|
|
|
vm_ip = "192.168.1.20";
|
2024-09-27 09:24:05 +02:00
|
|
|
vm_cpu = 1;
|
|
|
|
vm_mem = 512;
|
2024-09-10 14:40:56 +02:00
|
|
|
macAddr = "02:00:00:00:00:20";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
authentik = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-10-23 16:45:46 +02:00
|
|
|
agenix.nixosModules.default
|
2024-09-10 14:40:56 +02:00
|
|
|
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
|
2025-01-07 13:38:19 +01:00
|
|
|
"${inputs.self}/systems/minimalMicrovmConfig.nix"
|
2024-09-10 14:40:56 +02:00
|
|
|
"${inputs.self}/services"
|
|
|
|
{
|
2024-09-25 12:56:59 +02:00
|
|
|
microvm = {
|
|
|
|
volumes = [
|
|
|
|
{
|
|
|
|
mountPoint = "/media";
|
|
|
|
image = "/var/lib/microvms/authentik/media.img";
|
|
|
|
size = 2048;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2025-01-07 13:38:19 +01:00
|
|
|
services.micro_vm = {
|
2024-09-10 14:40:56 +02:00
|
|
|
enable = true;
|
|
|
|
hostname = "authentik";
|
|
|
|
vm_ip = "192.168.1.25";
|
|
|
|
vm_cpu = 2;
|
|
|
|
vm_mem = 2048;
|
|
|
|
macAddr = "02:00:00:00:00:25";
|
2024-09-09 10:48:56 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|