feat: trying out grocy

This commit is contained in:
arcnmx 2024-03-19 20:48:21 -07:00
parent a7e35fbc88
commit c27a8da537
5 changed files with 34 additions and 2 deletions

23
nixos/grocy.nix Normal file
View file

@ -0,0 +1,23 @@
{config, lib, ...}: let
inherit (lib.modules) mkDefault;
in {
config = {
services.grocy = {
enable = mkDefault true;
hostName = "grocy";
nginx.enableSSL = false;
settings = {
currency = mkDefault "CAD";
};
};
services.nginx = let
name.shortServer = mkDefault "grocy";
in {
virtualHosts = {
grocy = {
inherit name;
};
};
};
};
}

View file

@ -8,6 +8,7 @@
inherit (lib.attrsets) listToAttrs nameValuePair; inherit (lib.attrsets) listToAttrs nameValuePair;
inherit (access) nixosFor; inherit (access) nixosFor;
inherit (config.networking) hostName; inherit (config.networking) hostName;
inherit (config.services) nginx;
cfg = config.services.cloudflared; cfg = config.services.cloudflared;
apartment = "5e85d878-c6b2-4b15-b803-9aeb63d63543"; apartment = "5e85d878-c6b2-4b15-b803-9aeb63d63543";
accessHostFor = { accessHostFor = {
@ -49,11 +50,15 @@ in {
default = "http_status:404"; default = "http_status:404";
ingress = listToAttrs [ ingress = listToAttrs [
(ingressForNginx { (ingressForNginx {
host = config.services.zigbee2mqtt.domain; host = nginx.virtualHosts.zigbee2mqtt.serverName;
inherit hostName; inherit hostName;
}) })
(ingressForNginx { (ingressForNginx {
host = config.services.nginx.access.unifi.domain; host = nginx.access.unifi.domain;
inherit hostName;
})
(ingressForNginx {
host = nginx.virtualHosts.grocy.serverName;
inherit hostName; inherit hostName;
}) })
(ingressForHass {inherit hostName;}) (ingressForHass {inherit hostName;})

View file

@ -23,12 +23,14 @@ in {
nixos.home-assistant nixos.home-assistant
nixos.zigbee2mqtt nixos.zigbee2mqtt
nixos.syncplay nixos.syncplay
nixos.grocy
./cloudflared.nix ./cloudflared.nix
]; ];
services.nginx = { services.nginx = {
virtualHosts = { virtualHosts = {
zigbee2mqtt.proxied.enable = "cloudflared"; zigbee2mqtt.proxied.enable = "cloudflared";
grocy.proxied.enable = "cloudflared";
}; };
}; };

View file

@ -27,6 +27,7 @@ module "hakurei_system_records" {
"smb", "smb",
"kitchen", "kitchen",
"home", "home",
"grocy",
"yt", "yt",
] ]
global_subdomains = [ global_subdomains = [

View file

@ -74,6 +74,7 @@ module "tewi" {
"id", "id",
"z2m", "z2m",
"unifi", "unifi",
"grocy",
] ]
} }