From 192f6fa67b6a58bb20dec7a4ca5f1c4c6b895887 Mon Sep 17 00:00:00 2001 From: Ankit Pandey Date: Sun, 30 Jul 2023 16:14:45 -0700 Subject: [PATCH] ankisyncd-rs: allow specifying initial username and password anki-sync-server-rs exposes the ANKISYNCD_USERNAME and ANKISYNCD_PASSWORD env variables for initializing the auth db with a username and a password, which this exposes to make the config more reproducible for a single-user use case. --- nixos/modules/services/misc/ankisyncd.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nixos/modules/services/misc/ankisyncd.nix b/nixos/modules/services/misc/ankisyncd.nix index 7be8dc7dab8ff..5947d433126ef 100644 --- a/nixos/modules/services/misc/ankisyncd.nix +++ b/nixos/modules/services/misc/ankisyncd.nix @@ -48,6 +48,18 @@ in type = types.bool; description = lib.mdDoc "Whether to open the firewall for the specified port."; }; + + username = mkOption { + default = null; + type = types.nullOr types.str; + description = lib.mdDoc "Username of initial account."; + }; + + password = mkOption { + default = null; + type = types.nullOr types.str; + description = lib.mdDoc "Password of initial account."; + }; }; config = mkIf cfg.enable { @@ -59,6 +71,11 @@ in wantedBy = [ "multi-user.target" ]; path = [ cfg.package ]; + environment = { + ANKISYNCD_USERNAME = cfg.username; + ANKISYNCD_PASSWORD = cfg.password; + }; + serviceConfig = { Type = "simple"; DynamicUser = true;