2024-10-11 23:27:07 +03:00
|
|
|
{
|
2024-11-04 04:37:29 +03:00
|
|
|
__findFile,
|
|
|
|
config,
|
|
|
|
container,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
util,
|
|
|
|
...
|
|
|
|
} @args: let
|
|
|
|
cfg = config.container.module.home;
|
|
|
|
package = (pkgs.callPackage <package/homer> args);
|
|
|
|
in {
|
|
|
|
options.container.module.home = {
|
|
|
|
enable = lib.mkEnableOption "the dashboard.";
|
|
|
|
address = lib.mkOption {
|
|
|
|
default = "10.1.0.18";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
|
|
default = 80;
|
|
|
|
type = lib.types.int;
|
|
|
|
};
|
|
|
|
domain = lib.mkOption {
|
|
|
|
default = "home.${config.container.domain}";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
containers.home = container.mkContainer cfg {
|
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
|
|
|
environment.systemPackages = [
|
|
|
|
package
|
|
|
|
];
|
|
|
|
systemd.packages = [
|
|
|
|
package
|
|
|
|
];
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts.${cfg.domain} = container.mkServer {
|
|
|
|
default = true;
|
|
|
|
root = "${package}";
|
|
|
|
locations = {
|
|
|
|
"/".extraConfig = util.trimTabs ''
|
|
|
|
try_files $uri $uri/index.html;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
}
|