mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
nixos/gotify-server: add environment and environmentFiles options
This commit is contained in:
parent
e1ced8b12c
commit
0c2918fc91
@ -9,15 +9,51 @@ let
|
||||
cfg = config.services.gotify;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(lib.mkRenamedOptionModule
|
||||
[
|
||||
"services"
|
||||
"gotify"
|
||||
"port"
|
||||
]
|
||||
[
|
||||
"services"
|
||||
"gotify"
|
||||
"environment"
|
||||
"GOTIFY_SERVER_PORT"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
options.services.gotify = {
|
||||
enable = lib.mkEnableOption "Gotify webserver";
|
||||
|
||||
package = lib.mkPackageOption pkgs "gotify-server" { };
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
environment = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.oneOf [
|
||||
lib.types.str
|
||||
lib.types.int
|
||||
]
|
||||
);
|
||||
default = { };
|
||||
example = {
|
||||
GOTIFY_SERVER_PORT = 8080;
|
||||
GOTIFY_DATABASE_DIALECT = "sqlite3";
|
||||
};
|
||||
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" ];
|
||||
description = "Simple server for sending and receiving messages";
|
||||
|
||||
environment = {
|
||||
GOTIFY_SERVER_PORT = toString cfg.port;
|
||||
};
|
||||
environment = lib.mapAttrs (_: toString) cfg.environment;
|
||||
|
||||
serviceConfig = {
|
||||
WorkingDirectory = "/var/lib/${cfg.stateDirectoryName}";
|
||||
StateDirectory = cfg.stateDirectoryName;
|
||||
EnvironmentFile = cfg.environmentFiles;
|
||||
Restart = "always";
|
||||
DynamicUser = true;
|
||||
ExecStart = lib.getExe cfg.package;
|
||||
|
Loading…
Reference in New Issue
Block a user