feat(grocy): barcode buddy

This commit is contained in:
arcnmx 2024-03-22 07:49:54 -07:00
parent a157150956
commit dc0c84c0a0
13 changed files with 391 additions and 1 deletions

38
nixos/barcodebuddy.nix Normal file
View file

@ -0,0 +1,38 @@
{config, lib, ...}: let
inherit (lib.modules) mkDefault;
inherit (config.services) nginx;
cfg = config.services.barcodebuddy;
in {
config.services.barcodebuddy = {
enable = mkDefault true;
hostName = mkDefault "barcodebuddy";
reverseProxy.enable = mkDefault true;
settings = {
EXTERNAL_GROCY_URL = "https://grocy.${config.networking.domain}";
DISABLE_AUTHENTICATION = true;
};
nginxPhpConfig = ''
include ${config.sops.secrets.barcodebuddy-fastcgi-params.path};
'';
};
config.services.nginx.virtualHosts.barcodebuddy = {
vouch = {
enable = true;
requireAuth = false;
};
name.shortServer = mkDefault "bbuddy";
locations = {
"= /api/index.php" = {
vouch.requireAuth = false;
extraConfig = cfg.nginxPhpConfig;
};
"~ \\.php$" = {
vouch.requireAuth = true;
};
};
};
config.sops.secrets.barcodebuddy-fastcgi-params = {
sopsFile = mkDefault ./secrets/barcodebuddy.yaml;
owner = mkDefault nginx.user;
};
}