restructure and cleanup

This commit is contained in:
2026-05-04 15:32:16 -05:00
parent 7d0fb6ab9b
commit d7a55abee2
17 changed files with 47 additions and 851 deletions
@@ -1,13 +1,16 @@
{ pkgs, config, lib, inputs, ... }:
let
{
pkgs,
config,
lib,
inputs,
...
}: let
nixservice = "home-assistant";
service = "hass";
cfg = config.homelab.${service};
sec = config.sops.secrets;
homelab = config.homelab;
in
{
in {
options.homelab.${service} = {
enable = lib.mkEnableOption "enables ${service}";
@@ -44,9 +47,8 @@ in
};
config = lib.mkIf cfg.enable {
# declare ${service} group
users.groups.${service} = { gid = lib.mkForce cfg.ids; };
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
# declare ${service} user
users.users.${service} = {
@@ -71,10 +73,10 @@ in
volumes = [
"${cfg.data_dir}:/config"
];
# ports = [
# "0.0.0.0:7704:8123"
# "0.0.0.0:4141:4141"
# ];
# ports = [
# "0.0.0.0:7704:8123"
# "0.0.0.0:4141:4141"
# ];
environment = {
TZ = homelab.tz;
PUID = toString config.users.users.${service}.uid;
@@ -89,11 +91,11 @@ in
};
# open firewall
networking.firewall.allowedTCPPorts = [ cfg.port 8123 ];
networking.firewall.allowedTCPPorts = [cfg.port 8123];
# add to caddy for reverse proxy
services.caddy.virtualHosts."${cfg.url}" = {
serverAliases = [ "${service}.${homelab.public_domain}" ];
serverAliases = ["${service}.${homelab.public_domain}"];
extraConfig = ''
tls internal
reverse_proxy 127.0.0.1:${toString cfg.port}
@@ -101,22 +103,22 @@ in
};
# add to glance
homelab.glance.links.services = [{
title = "home assistant";
url = "https://hass.${homelab.public_domain}";
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
icon = "di:${nixservice}"; }];
homelab.glance.links.services = [
{
title = "home assistant";
url = "https://hass.${homelab.public_domain}";
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
icon = "di:${nixservice}";
}
];
# add to backups
homelab.backups.baks = {
${service} = { paths = [ cfg.data_dir ]; };
${service} = {paths = [cfg.data_dir];};
};
};
}
# here lies my tough, and I mean fucking tough, swing at
# getting this to work bare metal, ggs ill see you again
# - didnt take long
@@ -158,4 +160,3 @@ in
## };
# };