nix/container/Home.nix

46 lines
1,020 B
Nix
Raw Normal View History

2024-08-02 23:45:19 +03:00
{ container, pkgs, util, lib, config, __findFile, ... } @args: with lib; let
2024-06-25 04:04:39 +03:00
cfg = config.container.module.home;
2024-08-02 23:45:19 +03:00
package = (pkgs.callPackage <package/homer> args);
2024-06-09 23:35:53 +03:00
in {
2024-06-25 04:04:39 +03:00
options = {
container.module.home = {
enable = mkEnableOption "Dashboard.";
address = mkOption {
default = "10.1.0.18";
type = types.str;
};
port = mkOption {
default = 80;
type = types.int;
};
domain = mkOption {
default = "home.${config.container.domain}";
type = types.str;
};
};
};
config = 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-06-25 04:04:39 +03:00
services.nginx = {
enable = true;
virtualHosts.${cfg.domain} = container.mkServer {
default = true;
root = "${package}";
2024-06-09 23:35:53 +03:00
2024-06-25 04:04:39 +03:00
locations = {
"/".extraConfig = ''
try_files $uri $uri/index.html;
'';
};
2024-06-09 23:35:53 +03:00
};
};
};
};
};
}