2024-06-25 04:04:39 +03:00
|
|
|
{ container, lib, config, ... }: with lib; let
|
|
|
|
cfg = config.container.module.stock;
|
2024-06-09 23:35:53 +03:00
|
|
|
in {
|
2024-06-25 04:04:39 +03:00
|
|
|
options = {
|
|
|
|
container.module.stock = {
|
|
|
|
enable = mkEnableOption "Stock management.";
|
|
|
|
address = mkOption {
|
|
|
|
default = "10.1.0.45";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
port = mkOption {
|
|
|
|
default = 80;
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
domain = mkOption {
|
|
|
|
default = "stock.${config.container.domain}";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
storage = mkOption {
|
|
|
|
default = "${config.container.storage}/stock";
|
|
|
|
type = types.str;
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = container.mkContainerDir cfg [
|
|
|
|
"data"
|
|
|
|
];
|
|
|
|
|
|
|
|
containers.stock = container.mkContainer cfg {
|
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/grocy" = {
|
|
|
|
hostPath = "${cfg.storage}/data";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
|
|
|
services.grocy = {
|
|
|
|
enable = true;
|
|
|
|
dataDir = "/var/lib/grocy";
|
|
|
|
hostName = cfg.domain;
|
|
|
|
nginx.enableSSL = false;
|
|
|
|
settings = {
|
|
|
|
calendar = {
|
|
|
|
firstDayOfWeek = 1;
|
|
|
|
showWeekNumber = true;
|
|
|
|
};
|
|
|
|
culture = "en";
|
|
|
|
currency = "RUB";
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|