nixos/miniflux: use freeformType
This commit is contained in:
committed by
Robert Schütz
parent
166685187c
commit
bc58ca994c
@@ -17,7 +17,7 @@ let
|
||||
;
|
||||
cfg = config.services.miniflux;
|
||||
|
||||
defaultAddress = "localhost:8080";
|
||||
boolToInt = b: if b then 1 else 0;
|
||||
|
||||
pgbin = "${config.services.postgresql.package}/bin";
|
||||
preStart = pkgs.writeScript "miniflux-pre-start" ''
|
||||
@@ -44,25 +44,53 @@ in
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
type =
|
||||
with types;
|
||||
attrsOf (oneOf [
|
||||
str
|
||||
int
|
||||
]);
|
||||
example = literalExpression ''
|
||||
{
|
||||
CLEANUP_FREQUENCY = 48;
|
||||
LISTEN_ADDR = "localhost:8080";
|
||||
}
|
||||
'';
|
||||
type = types.submodule {
|
||||
freeformType =
|
||||
with types;
|
||||
attrsOf (oneOf [
|
||||
str
|
||||
int
|
||||
]);
|
||||
options = {
|
||||
LISTEN_ADDR = mkOption {
|
||||
type = types.str;
|
||||
default = "localhost:8080";
|
||||
description = ''
|
||||
Address to listen on. Use absolute path for a Unix socket.
|
||||
Multiple addresses can be specified, separated by commas.
|
||||
'';
|
||||
example = "127.0.0.1:8080, 127.0.0.1:8081";
|
||||
};
|
||||
DATABASE_URL = mkOption {
|
||||
type = types.str;
|
||||
defaultText = "user=miniflux host=/run/postgresql dbname=miniflux";
|
||||
description = ''
|
||||
Postgresql connection parameters.
|
||||
See [lib/pq](https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters) for more details.
|
||||
'';
|
||||
};
|
||||
RUN_MIGRATIONS = mkOption {
|
||||
type = with types; coercedTo bool boolToInt int;
|
||||
default = true;
|
||||
description = "Run database migrations.";
|
||||
};
|
||||
CREATE_ADMIN = mkOption {
|
||||
type = with types; coercedTo bool boolToInt int;
|
||||
default = true;
|
||||
description = "Create an admin user from environment variables.";
|
||||
};
|
||||
WATCHDOG = mkOption {
|
||||
type = with types; coercedTo bool boolToInt int;
|
||||
default = true;
|
||||
description = "Enable or disable Systemd watchdog.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration for Miniflux, refer to
|
||||
<https://miniflux.app/docs/configuration.html>
|
||||
for documentation on the supported values.
|
||||
|
||||
Correct configuration for the database is already provided.
|
||||
By default, listens on ${defaultAddress}.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -87,11 +115,7 @@ in
|
||||
}
|
||||
];
|
||||
services.miniflux.config = {
|
||||
LISTEN_ADDR = mkDefault defaultAddress;
|
||||
DATABASE_URL = lib.mkIf cfg.createDatabaseLocally "user=miniflux host=/run/postgresql dbname=miniflux";
|
||||
RUN_MIGRATIONS = 1;
|
||||
CREATE_ADMIN = lib.mkDefault 1;
|
||||
WATCHDOG = 1;
|
||||
};
|
||||
|
||||
services.postgresql = lib.mkIf cfg.createDatabaseLocally {
|
||||
|
||||
Reference in New Issue
Block a user