mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/gotify-server: add environment and environmentFiles options
This commit is contained in:
parent
e1ced8b12c
commit
0c2918fc91
1 changed files with 41 additions and 6 deletions
|
@ -9,15 +9,51 @@ let
|
||||||
cfg = config.services.gotify;
|
cfg = config.services.gotify;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
(lib.mkRenamedOptionModule
|
||||||
|
[
|
||||||
|
"services"
|
||||||
|
"gotify"
|
||||||
|
"port"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"services"
|
||||||
|
"gotify"
|
||||||
|
"environment"
|
||||||
|
"GOTIFY_SERVER_PORT"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
options.services.gotify = {
|
options.services.gotify = {
|
||||||
enable = lib.mkEnableOption "Gotify webserver";
|
enable = lib.mkEnableOption "Gotify webserver";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "gotify-server" { };
|
package = lib.mkPackageOption pkgs "gotify-server" { };
|
||||||
|
|
||||||
port = lib.mkOption {
|
environment = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.oneOf [
|
||||||
|
lib.types.str
|
||||||
|
lib.types.int
|
||||||
|
]
|
||||||
|
);
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
GOTIFY_SERVER_PORT = 8080;
|
||||||
|
GOTIFY_DATABASE_DIALECT = "sqlite3";
|
||||||
|
};
|
||||||
description = ''
|
description = ''
|
||||||
Port the server listens to.
|
Config environment variables for the gotify-server.
|
||||||
|
See https://gotify.net/docs/config for more details.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
environmentFiles = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.path;
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
|
Files containing additional config environment variables for gotify-server.
|
||||||
|
Secrets should be set in environmentFiles instead of environment.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,13 +73,12 @@ in
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
description = "Simple server for sending and receiving messages";
|
description = "Simple server for sending and receiving messages";
|
||||||
|
|
||||||
environment = {
|
environment = lib.mapAttrs (_: toString) cfg.environment;
|
||||||
GOTIFY_SERVER_PORT = toString cfg.port;
|
|
||||||
};
|
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
WorkingDirectory = "/var/lib/${cfg.stateDirectoryName}";
|
WorkingDirectory = "/var/lib/${cfg.stateDirectoryName}";
|
||||||
StateDirectory = cfg.stateDirectoryName;
|
StateDirectory = cfg.stateDirectoryName;
|
||||||
|
EnvironmentFile = cfg.environmentFiles;
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
ExecStart = lib.getExe cfg.package;
|
ExecStart = lib.getExe cfg.package;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue