diff --git a/nix/pkgs/linux.nix b/nix/pkgs/linux.nix index f495153..cb3fadd 100644 --- a/nix/pkgs/linux.nix +++ b/nix/pkgs/linux.nix @@ -1,6 +1,7 @@ { pkgs, config, + lib, nur, ... }: @@ -75,6 +76,57 @@ let rev = "21b79cca716af87b8a2b9e420c0e1d3d08b67414"; sha256 = "sha256-2xP9tHCmOM35fxFMbABUhHHnefv2sSCwhnYpjbHM/V0="; }; + + # User-specific librespot settings + librespot_device_name = "asahi-nixos-librespot"; + librespot_username = "martymeister98"; + librespot_bitrate = "320"; + + # Construct librespot arguments + librespot_args = '' + --name ${librespot_device_name} + --username ${librespot_username} + --bitrate ${librespot_bitrate} + --disable-audio-cache + --initial-volume 50 + ''; + + spotify_qt_initial_config = { + General = { + check_for_updates = false; + close_to_tray = false; + fallback_icons = false; + native_window = false; + notify_track_change = false; + relative_added = true; + show_changelog = false; + style = "Fusion"; + style_palette = 2; + track_list_resize_mode = 0; + track_numbers = 1; + tray_album_art = false; + tray_icon = false; + tray_light_icon = false; + }; + Qt = { + album_shape = 1; + album_size = 1; + library_layout = 1; + mirror_title_bar = false; + system_title_bar = true; + toolbar_position = 1; + }; + Spotify = { + path = "${pkgs.librespot}/bin/librespot"; + client_arguments = librespot_args; + always_start = true; + bitrate = 320; + disable_discovery = true; + start_client = true; + }; + }; + + spotify_qt_initial_json = builtins.toJSON spotify_qt_initial_config; in { wayland.windowManager.sway = { @@ -141,6 +193,10 @@ in grim slurp pavucontrol + legcord + spotify-qt + librespot + blueman ]; file = { @@ -151,6 +207,20 @@ in recursive = true; }; }; + + activation.conditionally_create_spotify-qt_config = lib.hm.dag.entryAfter [ "linkGeneration" ] '' + configFile="${config.home.homeDirectory}/.config/kraxarn/spotify-qt.json" + configDir="$(dirname "$configFile")" + if [ ! -f "$configFile" ]; then + echo "Initial spotify-qt.json not found. Creating with declarative defaults." + + mkdir -p "$configDir" + printf '%s' '${spotify_qt_initial_json}' > "$configFile" + echo "Initial spotify-qt.json created at $configFile." + else + echo "spotify-qt.json already exists at $configFile. Skipping initial creation." + fi + ''; }; programs = {