nixos/services.rmfakecloud: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-30 00:46:45 +02:00
parent 724f15d7d8
commit e3f2e1c9fb

View File

@ -4,9 +4,6 @@
pkgs,
...
}:
with lib;
let
cfg = config.services.rmfakecloud;
serviceDataDir = "/var/lib/rmfakecloud";
@ -15,28 +12,28 @@ in
{
options = {
services.rmfakecloud = {
enable = mkEnableOption "rmfakecloud remarkable self-hosted cloud";
enable = lib.mkEnableOption "rmfakecloud remarkable self-hosted cloud";
package = mkPackageOption pkgs "rmfakecloud" { };
package = lib.mkPackageOption pkgs "rmfakecloud" { };
storageUrl = mkOption {
type = types.str;
storageUrl = lib.mkOption {
type = lib.types.str;
example = "https://local.appspot.com";
description = ''
URL used by the tablet to access the rmfakecloud service.
'';
};
port = mkOption {
type = types.port;
port = lib.mkOption {
type = lib.types.port;
default = 3000;
description = ''
Listening port number.
'';
};
logLevel = mkOption {
type = types.enum [
logLevel = lib.mkOption {
type = lib.types.enum [
"info"
"debug"
"warn"
@ -48,8 +45,8 @@ in
'';
};
extraSettings = mkOption {
type = with types; attrsOf str;
extraSettings = lib.mkOption {
type = with lib.types; attrsOf str;
default = { };
example = {
DATADIR = "/custom/path/for/rmfakecloud/data";
@ -63,8 +60,8 @@ in
'';
};
environmentFile = mkOption {
type = with types; nullOr path;
environmentFile = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
example = "/etc/secrets/rmfakecloud.env";
description = ''
@ -78,7 +75,7 @@ in
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
systemd.services.rmfakecloud = {
description = "rmfakecloud remarkable self-hosted cloud";
@ -113,9 +110,9 @@ in
Type = "simple";
Restart = "always";
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
AmbientCapabilities = mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
AmbientCapabilities = lib.mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
DynamicUser = true;
PrivateDevices = true;
@ -148,5 +145,5 @@ in
};
};
meta.maintainers = with maintainers; [ pacien ];
meta.maintainers = with lib.maintainers; [ pacien ];
}