···
++ optionals (cfg.salt != null) [ "--salt" cfg.salt ]
11
-
++ optionals (cfg.certDir != null) [ "--tls" cfg.certDir ];
11
+
++ optionals (cfg.certDir != null) [ "--tls" cfg.certDir ]
···
description = lib.mdDoc ''
Salt to allow room operator passwords generated by this server
36
-
instance to still work when the server is restarted.
37
+
instance to still work when the server is restarted. The salt will be
38
+
readable in the nix store and the processlist. If this is not
39
+
intended use `saltFile` instead. Mutually exclusive with
40
+
<option>services.syncplay.saltFile</option>.
44
+
saltFile = mkOption {
45
+
type = types.nullOr types.path;
47
+
description = lib.mdDoc ''
48
+
Path to the file that contains the server salt. This allows room
49
+
operator passwords generated by this server instance to still work
50
+
when the server is restarted. `null`, the server doesn't load the
51
+
salt from a file. Mutually exclusive with
52
+
<option>services.syncplay.salt</option>.
···
65
+
extraArgs = mkOption {
66
+
type = types.listOf types.str;
68
+
description = lib.mdDoc ''
69
+
Additional arguments to be passed to the service.
···
config = mkIf cfg.enable {
103
+
assertion = cfg.salt == null || cfg.saltFile == null;
104
+
message = "services.syncplay.salt and services.syncplay.saltFile are mutually exclusive.";
systemd.services.syncplay = {
description = "Syncplay Service";
79
-
wantedBy = [ "multi-user.target" ];
80
-
after = [ "network-online.target" ];
109
+
wantedBy = [ "multi-user.target" ];
110
+
after = [ "network-online.target" ];
85
-
LoadCredential = lib.mkIf (cfg.passwordFile != null) "password:${cfg.passwordFile}";
115
+
LoadCredential = lib.optional (cfg.passwordFile != null) "password:${cfg.passwordFile}"
116
+
++ lib.optional (cfg.saltFile != null) "salt:${cfg.saltFile}";
${lib.optionalString (cfg.passwordFile != null) ''
export SYNCPLAY_PASSWORD=$(cat "''${CREDENTIALS_DIRECTORY}/password")
123
+
${lib.optionalString (cfg.saltFile != null) ''
124
+
export SYNCPLAY_SALT=$(cat "''${CREDENTIALS_DIRECTORY}/salt")
exec ${pkgs.syncplay-nogui}/bin/syncplay-server ${escapeShellArgs cmdArgs}