diff --git a/modules/applications/packages.nix b/modules/applications/packages.nix index 5b45878..f73fab6 100644 --- a/modules/applications/packages.nix +++ b/modules/applications/packages.nix @@ -50,6 +50,7 @@ with config.deviceSpecific; { ncdu nnn ranger + spotify-tui # gui discord diff --git a/modules/applications/spotify/default.nix b/modules/applications/spotify/default.nix index acc50dc..0233ef8 100644 --- a/modules/applications/spotify/default.nix +++ b/modules/applications/spotify/default.nix @@ -1,7 +1,25 @@ { config, lib, pkgs, ... }: { home-manager.users.alukard = { - xdg.configFile."spicetify/Themes/base16/color.ini".source = ./color.ini; - xdg.configFile."spicetify/Themes/base16/user.css".source = ./user.css; + # xdg.configFile."spicetify/Themes/base16/color.ini".source = ./color.ini; + # xdg.configFile."spicetify/Themes/base16/user.css".source = ./user.css; + services.spotifyd = { + enable = true; + package = (pkgs.spotifyd.override { withALSA = false; withPulseAudio = true; withPortAudio = false; }); + settings = { + global = { + username = "${config.secrets.spotify.user}"; + password = "${config.secrets.spotify.password}"; + backend = "pulseaudio"; + volume_controller = "softvol"; + device_name = "nix"; + bitrate = 320; + no_audio_cache = true; + volume_normalisation = false; + device_type = "computer"; + cache_path = "${config.users.users.alukard.home}/.cache/spotifyd"; + }; + }; + }; }; } diff --git a/modules/default.nix b/modules/default.nix index 5dc644c..a3f17cb 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -10,6 +10,7 @@ builtins.listToAttrs (builtins.map (path: { ./applications/mpv.nix ./applications/packages.nix ./applications/rofi.nix + ./applications/spotify ./applications/urxvt.nix ./applications/vscode.nix @@ -28,7 +29,6 @@ builtins.listToAttrs (builtins.map (path: { ./workspace/misc.nix ./workspace/picom.nix ./workspace/pulseeffects - # ./workspace/spotifyd.nix ./workspace/ssh.nix ./workspace/xresources.nix ./workspace/zsh.nix diff --git a/modules/overlay.nix b/modules/overlay.nix index 2d09ac8..f9844ac 100644 --- a/modules/overlay.nix +++ b/modules/overlay.nix @@ -22,6 +22,7 @@ in bpytop = pkgs.callPackage ./packages/bpytop.nix { }; ibm-plex-powerline = pkgs.callPackage ./packages/ibm-plex-powerline.nix { }; bibata-cursors = pkgs.callPackage ./packages/bibata-cursors.nix { }; + spotifyd = pkgs.callPackage ./packages/spotifyd.nix { }; # UPDATE vivaldi = super.vivaldi.overrideAttrs (old: rec { version = "3.6.2165.36-1"; diff --git a/modules/packages/spotifyd.nix b/modules/packages/spotifyd.nix new file mode 100644 index 0000000..8177dbc --- /dev/null +++ b/modules/packages/spotifyd.nix @@ -0,0 +1,46 @@ +{ lib, fetchFromGitHub, rustPackages_1_45, pkg-config, openssl +, withALSA ? true, alsaLib ? null +, withPulseAudio ? false, libpulseaudio ? null +, withPortAudio ? false, portaudio ? null +, withMpris ? false +, withKeyring ? false +, dbus ? null +}: + +rustPackages_1_45.rustPlatform.buildRustPackage rec { + pname = "spotifyd"; + version = "0.3.0"; + + src = fetchFromGitHub { + owner = "Spotifyd"; + repo = "spotifyd"; + rev = "v${version}"; + sha256 = "055njhy9if4qpsbgbr6615xxhcx9plava1m4l323vi4dbw09wh5r"; + }; + + cargoSha256 = "1ijrl208607abjwpr3cajcbj6sr35bk6ik778a58zf28kzdhrawc"; + + cargoBuildFlags = [ + "--no-default-features" + "--features" + "${lib.optionalString withALSA "alsa_backend,"}${lib.optionalString withPulseAudio "pulseaudio_backend,"}${lib.optionalString withPortAudio "portaudio_backend,"}${lib.optionalString withMpris "dbus_mpris,"}${lib.optionalString withKeyring "dbus_keyring,"}" + ]; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] + ++ lib.optional withALSA alsaLib + ++ lib.optional withPulseAudio libpulseaudio + ++ lib.optional withPortAudio portaudio + ++ lib.optional (withMpris || withKeyring) dbus; + + doCheck = false; + + meta = with lib; { + description = "An open source Spotify client running as a UNIX daemon"; + homepage = "https://github.com/Spotifyd/spotifyd"; + license = with licenses; [ gpl3 ]; + maintainers = with maintainers; [ anderslundstedt Br1ght0ne marsam ]; + platforms = platforms.unix; + }; +} \ No newline at end of file diff --git a/modules/sound/pulseaudio.nix b/modules/sound/pulseaudio.nix index 5f6035b..f339808 100644 --- a/modules/sound/pulseaudio.nix +++ b/modules/sound/pulseaudio.nix @@ -3,7 +3,7 @@ enable = true; # package = pkgs.pulseaudioFull; support32Bit = true; - # systemWide = true; + systemWide = true; tcp = { enable = true; anonymousClients.allowedIpRanges = ["127.0.0.1"]; diff --git a/modules/workspace/i3/default.nix b/modules/workspace/i3/default.nix index 32a8643..296f86a 100644 --- a/modules/workspace/i3/default.nix +++ b/modules/workspace/i3/default.nix @@ -14,7 +14,7 @@ in { "" = [ { class = "Spotify"; } { class = "PulseEffects"; } - { class = "spt"; } + { title = "spt"; } ]; "" = [ { class = "^Telegram"; } @@ -86,10 +86,8 @@ in { { command = "${pkgs.feh}/bin/feh --bg-fill $HOME/nixos-config/misc/wallpaper"; } { command = "${pkgs.xorg.xrdb}/bin/xrdb -merge ~/.Xresources"; } { command = "${pkgs.tdesktop}/bin/telegram-desktop"; } - { - command = - "${pkgs.keepassxc}/bin/keepassxc --keyfile=/home/alukard/.passwords.key /home/alukard/nixos-config/misc/Passwords.kdbx"; - } + { command = "${pkgs.keepassxc}/bin/keepassxc --keyfile=/home/alukard/.passwords.key /home/alukard/nixos-config/misc/Passwords.kdbx"; } + { command = "${apps.term.cmd} spt"; } ]; keybindings = let script = name: content: "exec ${pkgs.writeScript name content}"; diff --git a/modules/workspace/spotifyd.nix b/modules/workspace/spotifyd.nix deleted file mode 100644 index 68c21be..0000000 --- a/modules/workspace/spotifyd.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, config, lib, ... }: -let - spotifydConf = pkgs.writeText "spotifyd.conf" '' - [global] - username = ${config.secrets.spotify.user} - password = ${config.secrets.spotify.password} - use_keyring = false - bitrate = 320 - volume_normalisation = false - backend = pulseaudio - ''; -in { - #TODO: отвязать от папки пользователя - systemd.user.services.spotifyd = { - wantedBy = [ "default.target" ]; - after = [ "network-online.target" "sound.target" ]; - description = "spotifyd, a Spotify playing daemon"; - serviceConfig = { - ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache-path /home/alukard/.cache/spotifyd --config-path ${spotifydConf}"; - Restart = "always"; - RestartSec = 12; - }; - }; - # services.spotifyd = { - # enable = true; - # config = '' - # [global] - # username = ${config.secrets.spotify.user} - # password = ${config.secrets.spotify.password} - # use_keyring = false - # bitrate = 320 - # volume_normalisation = false - # backend = pulseaudio - # ''; - # }; -} \ No newline at end of file diff --git a/profiles/desktop.nix b/profiles/desktop.nix index 70d7783..031f2f6 100644 --- a/profiles/desktop.nix +++ b/profiles/desktop.nix @@ -20,6 +20,7 @@ mpv packages rofi + spotify urxvt vscode