mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
nixos/miniflux: make admin provisioning optional
Miniflux supports provisioning users via SSO, which renders admin accounts unnecessary for some use-cases. This change retains the existing default, but makes it easier to disable admin provisioning.
This commit is contained in:
parent
730aa60b27
commit
f6788b6165
1 changed files with 9 additions and 3 deletions
|
@ -49,7 +49,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
adminCredentialsFile = mkOption {
|
adminCredentialsFile = mkOption {
|
||||||
type = types.path;
|
type = types.nullOr types.path;
|
||||||
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
File containing the ADMIN_USERNAME and
|
File containing the ADMIN_USERNAME and
|
||||||
ADMIN_PASSWORD (length >= 6) in the format of
|
ADMIN_PASSWORD (length >= 6) in the format of
|
||||||
|
@ -61,11 +62,16 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{ assertion = cfg.config.CREATE_ADMIN == 0 || cfg.adminCredentialsFile != null;
|
||||||
|
message = "services.miniflux.adminCredentialsFile must be set if services.miniflux.config.CREATE_ADMIN is 1";
|
||||||
|
}
|
||||||
|
];
|
||||||
services.miniflux.config = {
|
services.miniflux.config = {
|
||||||
LISTEN_ADDR = mkDefault defaultAddress;
|
LISTEN_ADDR = mkDefault defaultAddress;
|
||||||
DATABASE_URL = lib.mkIf cfg.createDatabaseLocally "user=miniflux host=/run/postgresql dbname=miniflux";
|
DATABASE_URL = lib.mkIf cfg.createDatabaseLocally "user=miniflux host=/run/postgresql dbname=miniflux";
|
||||||
RUN_MIGRATIONS = 1;
|
RUN_MIGRATIONS = 1;
|
||||||
CREATE_ADMIN = 1;
|
CREATE_ADMIN = lib.mkDefault 1;
|
||||||
WATCHDOG = 1;
|
WATCHDOG = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,7 +109,7 @@ in
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
RuntimeDirectory = "miniflux";
|
RuntimeDirectory = "miniflux";
|
||||||
RuntimeDirectoryMode = "0750";
|
RuntimeDirectoryMode = "0750";
|
||||||
EnvironmentFile = cfg.adminCredentialsFile;
|
EnvironmentFile = lib.mkIf (cfg.adminCredentialsFile != null) cfg.adminCredentialsFile;
|
||||||
WatchdogSec = 60;
|
WatchdogSec = 60;
|
||||||
WatchdogSignal = "SIGKILL";
|
WatchdogSignal = "SIGKILL";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue