Centralize Tensamin packages modules and release automation
This commit is contained in:
parent
423ee32a37
commit
123205c97d
28 changed files with 32292 additions and 10 deletions
51
modules/client.nix
Normal file
51
modules/client.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{ self }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tensamin.client;
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.tensamin.client = {
|
||||
enable = lib.mkEnableOption "the static Tensamin web client";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = self.packages.${pkgs.stdenv.hostPlatform.system}.client-web;
|
||||
description = "Static client package with index.html at its output root.";
|
||||
};
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
default = "localhost";
|
||||
};
|
||||
bindAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8080;
|
||||
};
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nginx.enable = true;
|
||||
services.nginx.virtualHosts.${cfg.hostName} = {
|
||||
listen = [
|
||||
{
|
||||
addr = cfg.bindAddress;
|
||||
inherit (cfg) port;
|
||||
}
|
||||
];
|
||||
root = cfg.package;
|
||||
locations."/".tryFiles = "$uri $uri/ /index.html";
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.port ];
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue