nix-config/modules/optional/streamdeck.nix

41 lines
1.1 KiB
Nix
Raw Normal View History

2023-09-05 23:01:07 +02:00
{
lib,
pkgs,
...
}: let
inherit
(lib)
types
mkEnableOption
mkPackageOption
mkOption
mkIf
;
settingsFormat = pkgs.formats.json {};
in {
home-manager.sharedModules = [
({config, ...}: {
options.programs.streamdeck-ui = {
enable = mkEnableOption "streamdeck-ui";
package = mkPackageOption pkgs "streamdeck-ui" {};
settings = mkOption {
default = {};
type = types.submodule {freeformType = settingsFormat.type;};
description = "Configuration per streamdeck";
};
};
config = mkIf config.programs.streamdeck-ui.enable {
2023-09-20 18:53:35 +02:00
home.packages = [pkgs.streamdeck-ui];
2023-09-22 20:57:08 +02:00
home.sessionVariables.STREAMDECK_UI_CONFIG = "${config.xdg.configHome}/streamdeck-ui/config.json";
xdg.configFile.streamdeck-ui = {
target = "streamdeck-ui/config.json";
source = settingsFormat.generate "config.json" {
streamdeck_ui_version = 1;
state = config.programs.streamdeck-ui.settings;
};
};
};
})
];
2023-09-05 23:01:07 +02:00
}