diff options
author | Felix Buehler | 2024-08-24 22:05:51 +0200 |
---|---|---|
committer | Felix Buehler | 2024-08-30 23:00:54 +0200 |
commit | 457b7563d4776f085d30faf2fa7b4e502d4a1d7f (patch) | |
tree | a9b6a58d306e800df4144eb31e36e719dba56d72 /nixos | |
parent | eeed115e37941d9e21adba217c125a3c8d8d41b0 (diff) |
nixos/services.ntfy-sh: remove `with lib;`
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/ntfy-sh.nix | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/nixos/modules/services/misc/ntfy-sh.nix b/nixos/modules/services/misc/ntfy-sh.nix index ae6ab9571d0f..db857a3f1472 100644 --- a/nixos/modules/services/misc/ntfy-sh.nix +++ b/nixos/modules/services/misc/ntfy-sh.nix @@ -1,7 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.ntfy-sh; @@ -10,28 +7,28 @@ in { options.services.ntfy-sh = { - enable = mkEnableOption "[ntfy-sh](https://ntfy.sh), a push notification service"; + enable = lib.mkEnableOption "[ntfy-sh](https://ntfy.sh), a push notification service"; - package = mkPackageOption pkgs "ntfy-sh" { }; + package = lib.mkPackageOption pkgs "ntfy-sh" { }; - user = mkOption { + user = lib.mkOption { default = "ntfy-sh"; - type = types.str; + type = lib.types.str; description = "User the ntfy-sh server runs under."; }; - group = mkOption { + group = lib.mkOption { default = "ntfy-sh"; - type = types.str; + type = lib.types.str; description = "Primary group of ntfy-sh user."; }; - settings = mkOption { - type = types.submodule { + settings = lib.mkOption { + type = lib.types.submodule { freeformType = settingsFormat.type; options = { - base-url = mkOption { - type = types.str; + base-url = lib.mkOption { + type = lib.types.str; example = "https://ntfy.example"; description = '' Public facing base URL of the service @@ -49,7 +46,7 @@ in default = { }; - example = literalExpression '' + example = lib.literalExpression '' { listen-http = ":8080"; } @@ -65,7 +62,7 @@ in let configuration = settingsFormat.generate "server.yml" cfg.settings; in - mkIf cfg.enable { + lib.mkIf cfg.enable { # to configure access control via the cli environment = { etc."ntfy/server.yml".source = configuration; @@ -73,10 +70,10 @@ in }; services.ntfy-sh.settings = { - auth-file = mkDefault "/var/lib/ntfy-sh/user.db"; - listen-http = mkDefault "127.0.0.1:2586"; - attachment-cache-dir = mkDefault "/var/lib/ntfy-sh/attachments"; - cache-file = mkDefault "/var/lib/ntfy-sh/cache-file.db"; + auth-file = lib.mkDefault "/var/lib/ntfy-sh/user.db"; + listen-http = lib.mkDefault "127.0.0.1:2586"; + attachment-cache-dir = lib.mkDefault "/var/lib/ntfy-sh/attachments"; + cache-file = lib.mkDefault "/var/lib/ntfy-sh/cache-file.db"; }; systemd.services.ntfy-sh = { @@ -110,11 +107,11 @@ in }; }; - users.groups = optionalAttrs (cfg.group == "ntfy-sh") { + users.groups = lib.optionalAttrs (cfg.group == "ntfy-sh") { ntfy-sh = { }; }; - users.users = optionalAttrs (cfg.user == "ntfy-sh") { + users.users = lib.optionalAttrs (cfg.user == "ntfy-sh") { ntfy-sh = { isSystemUser = true; group = cfg.group; |