Add spotifyd package and service (#65092)
Add spotifyd package and service
This commit is contained in:
commit
101a4be5a7
5 changed files with 94 additions and 0 deletions
|
@ -333,6 +333,11 @@
|
|||
github = "andersk";
|
||||
name = "Anders Kaseorg";
|
||||
};
|
||||
anderslundstedt = {
|
||||
email = "git@anderslundstedt.se";
|
||||
github = "anderslundstedt";
|
||||
name = "Anders Lundstedt";
|
||||
};
|
||||
AndersonTorres = {
|
||||
email = "torres.anderson.85@protonmail.com";
|
||||
github = "AndersonTorres";
|
||||
|
|
|
@ -198,6 +198,7 @@
|
|||
./services/audio/slimserver.nix
|
||||
./services/audio/snapserver.nix
|
||||
./services/audio/squeezelite.nix
|
||||
./services/audio/spotifyd.nix
|
||||
./services/audio/ympd.nix
|
||||
./services/backup/automysqlbackup.nix
|
||||
./services/backup/bacula.nix
|
||||
|
|
42
nixos/modules/services/audio/spotifyd.nix
Normal file
42
nixos/modules/services/audio/spotifyd.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.spotifyd;
|
||||
spotifydConf = pkgs.writeText "spotifyd.conf" cfg.config;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.spotifyd = {
|
||||
enable = mkEnableOption "spotifyd, a Spotify playing daemon";
|
||||
|
||||
config = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Configuration for Spotifyd. For syntax and directives, see
|
||||
https://github.com/Spotifyd/spotifyd#Configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.spotifyd = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" "sound.target" ];
|
||||
description = "spotifyd, a Spotify playing daemon";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache_path /var/cache/spotifyd --config ${spotifydConf}";
|
||||
Restart = "always";
|
||||
RestartSec = 12;
|
||||
DynamicUser = true;
|
||||
CacheDirectory = "spotifyd";
|
||||
SupplementaryGroups = ["audio"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = [ maintainers.anderslundstedt ];
|
||||
}
|
40
pkgs/applications/audio/spotifyd/default.nix
Normal file
40
pkgs/applications/audio/spotifyd/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl
|
||||
, withALSA ? true, alsaLib ? null
|
||||
, withPulseAudio ? false, libpulseaudio ? null
|
||||
, withPortAudio ? false, portaudio ? null
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "spotifyd";
|
||||
version = "0.2.11";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Spotifyd";
|
||||
repo = "spotifyd";
|
||||
rev = "${version}";
|
||||
sha256 = "1iybk9xrrvhrcl2xl5r2xhyn1ydhrgwnnb8ldhsw5c16b32z03q1";
|
||||
};
|
||||
|
||||
cargoSha256 = "0879p1h32259schmy8j3xnwpw3sw80f8mrj8s6b5aihi3yyzz521";
|
||||
|
||||
cargoBuildFlags = [
|
||||
"--no-default-features"
|
||||
"--features"
|
||||
"${stdenv.lib.optionalString withALSA "alsa_backend,"}${stdenv.lib.optionalString withPulseAudio "pulseaudio_backend,"}${stdenv.lib.optionalString withPortAudio "portaudio_backend,"}"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
buildInputs = [ openssl ]
|
||||
++ stdenv.lib.optional withALSA alsaLib
|
||||
++ stdenv.lib.optional withPulseAudio libpulseaudio
|
||||
++ stdenv.lib.optional withPortAudio portaudio;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "An open source Spotify client running as a UNIX daemon";
|
||||
homepage = "https://github.com/Spotifyd/spotifyd";
|
||||
license = with licenses; [ gpl3 ];
|
||||
maintainers = [ maintainers.anderslundstedt ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
|
@ -18538,6 +18538,12 @@ in
|
|||
|
||||
spectral = qt5.callPackage ../applications/networking/instant-messengers/spectral { };
|
||||
|
||||
spotifyd = callPackage ../applications/audio/spotifyd {
|
||||
withALSA = stdenv.isLinux;
|
||||
withPulseAudio = config.pulseaudio or true;
|
||||
withPortAudio = stdenv.isDarwin;
|
||||
};
|
||||
|
||||
super-productivity = callPackage ../applications/networking/super-productivity { };
|
||||
|
||||
wlc = callPackage ../development/libraries/wlc { };
|
||||
|
|
Loading…
Reference in a new issue