.hive/modules/programs/spotify-shortcuts.nix

29 lines
772 B
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.hive.programs.spotify-shortcuts;
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";
};
clientSecretFile = lib.mkOption {
type = lib.types.path;
description = "Spotify API Client Secret Path";
};
};
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})
'';
};
}