System Gen86 @ 2025-07-24-20:32:00 by jonas@monolith

This commit is contained in:
2025-07-24 20:32:00 +02:00
parent 9a641f55cd
commit 680378e691
3 changed files with 38 additions and 21 deletions

View File

@@ -8,21 +8,26 @@
in {
options.hive.programs.spotify-shortcuts = {
enable = lib.mkEnableOption "Enable Spotify Shortcuts";
clientIdFile = lib.mkOption {
type = lib.types.path;
description = "Spotify API Client ID Path";
clientIdSopsKey = lib.mkOption {
type = lib.types.singleLineStr;
description = "Spotify API Client ID sops secret name";
};
clientSecretFile = lib.mkOption {
type = lib.types.path;
description = "Spotify API Client Secret Path";
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.etc."profile.d/spotify-shortcuts.sh".text = ''
export SPOTIFY_SHORTCUTS_CLIENT_ID=$(cat ${cfg.clientIdFile})
export SPOTIFY_SHORTCUTS_CLIENT_SECRET=$(cat ${cfg.clientSecretFile})
environment.variables = {
SPOTIFY_SHORTCUTS_CONFIG = config.sops.templates."spotify-shortcuts-client.json".path;
};
sops.templates."spotify-shortcuts-client.json".content = ''
{
"clientId": "${config.sops.placeholder.${cfg.clientIdSopsKey}}",
"clientSecret": "${config.sops.placeholder.${cfg.clientSecretSopsKey}}"
}
'';
};
}