openrgb: add startupProfile option to service (#408517)

Changed files
+8 -1
nixos
modules
services
hardware
+8 -1
nixos/modules/services/hardware/openrgb.nix
···
description = "Set server port of openrgb.";
};
+
startupProfile = lib.mkOption {
+
type = lib.types.nullOr (lib.types.str);
+
default = null;
+
description = "The profile file to load from \"/var/lib/OpenRGB\" at startup.";
+
};
};
config = lib.mkIf cfg.enable {
···
serviceConfig = {
StateDirectory = "OpenRGB";
WorkingDirectory = "/var/lib/OpenRGB";
-
ExecStart = "${cfg.package}/bin/openrgb --server --server-port ${toString cfg.server.port}";
+
ExecStart =
+
"${cfg.package}/bin/openrgb --server --server-port ${toString cfg.server.port}"
+
+ lib.optionalString (builtins.isString cfg.startupProfile) " --profile ${lib.escapeShellArg cfg.startupProfile}";
Restart = "always";
};
};