use spotifyd

This commit is contained in:
Dmitriy Kholkin 2021-02-17 01:00:52 +03:00
parent c03110f321
commit a75b704ae5
9 changed files with 74 additions and 45 deletions

View File

@ -50,6 +50,7 @@ with config.deviceSpecific; {
ncdu
nnn
ranger
spotify-tui
# gui
discord

View File

@ -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";
};
};
};
};
}

View File

@ -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

View File

@ -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";

View File

@ -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;
};
}

View File

@ -3,7 +3,7 @@
enable = true;
# package = pkgs.pulseaudioFull;
support32Bit = true;
# systemWide = true;
systemWide = true;
tcp = {
enable = true;
anonymousClients.allowedIpRanges = ["127.0.0.1"];

View File

@ -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}";

View File

@ -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
# '';
# };
}

View File

@ -20,6 +20,7 @@
mpv
packages
rofi
spotify
urxvt
vscode