37 lines
1.0 KiB
Nix
37 lines
1.0 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
cfg = config.hive.programs.spotify-shortcuts;
|
|
in {
|
|
options.hive.programs.spotify-shortcuts = {
|
|
enable = lib.mkEnableOption "Enable Spotify Shortcuts";
|
|
clientIdSopsKey = lib.mkOption {
|
|
type = lib.types.singleLineStr;
|
|
description = "Spotify API Client ID sops secret name";
|
|
};
|
|
clientSecretSopsKey = lib.mkOption {
|
|
type = lib.types.singleLineStr;
|
|
description = "Spotify API Client Secret Path sops secret name";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = [pkgs.hive.spotify-shortcuts];
|
|
environment.variables = {
|
|
SPOTIFY_SHORTCUTS_CONFIG = config.sops.templates."spotify-shortcuts-client.json".path;
|
|
};
|
|
sops.templates."spotify-shortcuts-client.json" = {
|
|
mode = "644";
|
|
content = ''
|
|
{
|
|
"clientId": "${config.sops.placeholder.${cfg.clientIdSopsKey}}",
|
|
"clientSecret": "${config.sops.placeholder.${cfg.clientSecretSopsKey}}"
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
}
|