git.iko.soy/typeable/nixpkgs
on master help sign in
Add spotifyd package and service (#65092)

Add spotifyd package and service

commit101a4be5a77bd6ee7af655bbc565efd43bb3a1e7 authorFlorian Klink <flokli@flokli.de> dateWed 24 Jul 2019, 00:54 (7 years ago) parent471ff0553841fc
5 files changed+94
maintainers/maintainer-list.nix+5 nixos/modules/module-list.nix+1 nixos/modules/services/audio/spotifyd.nix+42 pkgs/applications/audio/spotifyd/default.nix+40 pkgs/top-level/all-packages.nix+6
maintainers/maintainer-list.nix+5
@@ -333,6 +333,11 @@
333333 github = "andersk";
334334 name = "Anders Kaseorg";
335335 };
336+ anderslundstedt = {
337+ email = "git@anderslundstedt.se";
338+ github = "anderslundstedt";
339+ name = "Anders Lundstedt";
340+ };
336341 AndersonTorres = {
337342 email = "torres.anderson.85@protonmail.com";
338343 github = "AndersonTorres";
nixos/modules/module-list.nix+1
@@ -198,6 +198,7 @@
198198 ./services/audio/slimserver.nix
199199 ./services/audio/snapserver.nix
200200 ./services/audio/squeezelite.nix
201+ ./services/audio/spotifyd.nix
201202 ./services/audio/ympd.nix
202203 ./services/backup/automysqlbackup.nix
203204 ./services/backup/bacula.nix
nixos/modules/services/audio/spotifyd.nixnew file+42
@@ -0,0 +1,42 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.spotifyd;
7+ spotifydConf = pkgs.writeText "spotifyd.conf" cfg.config;
8+in
9+{
10+ options = {
11+ services.spotifyd = {
12+ enable = mkEnableOption "spotifyd, a Spotify playing daemon";
13+
14+ config = mkOption {
15+ default = "";
16+ type = types.lines;
17+ description = ''
18+ Configuration for Spotifyd. For syntax and directives, see
19+ https://github.com/Spotifyd/spotifyd#Configuration.
20+ '';
21+ };
22+ };
23+ };
24+
25+ config = mkIf cfg.enable {
26+ systemd.services.spotifyd = {
27+ wantedBy = [ "multi-user.target" ];
28+ after = [ "network-online.target" "sound.target" ];
29+ description = "spotifyd, a Spotify playing daemon";
30+ serviceConfig = {
31+ ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache_path /var/cache/spotifyd --config ${spotifydConf}";
32+ Restart = "always";
33+ RestartSec = 12;
34+ DynamicUser = true;
35+ CacheDirectory = "spotifyd";
36+ SupplementaryGroups = ["audio"];
37+ };
38+ };
39+ };
40+
41+ meta.maintainers = [ maintainers.anderslundstedt ];
42+}
pkgs/applications/audio/spotifyd/default.nixnew file+40
@@ -0,0 +1,40 @@
1+{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl
2+, withALSA ? true, alsaLib ? null
3+, withPulseAudio ? false, libpulseaudio ? null
4+, withPortAudio ? false, portaudio ? null
5+}:
6+
7+rustPlatform.buildRustPackage rec {
8+ pname = "spotifyd";
9+ version = "0.2.11";
10+
11+ src = fetchFromGitHub {
12+ owner = "Spotifyd";
13+ repo = "spotifyd";
14+ rev = "${version}";
15+ sha256 = "1iybk9xrrvhrcl2xl5r2xhyn1ydhrgwnnb8ldhsw5c16b32z03q1";
16+ };
17+
18+ cargoSha256 = "0879p1h32259schmy8j3xnwpw3sw80f8mrj8s6b5aihi3yyzz521";
19+
20+ cargoBuildFlags = [
21+ "--no-default-features"
22+ "--features"
23+ "${stdenv.lib.optionalString withALSA "alsa_backend,"}${stdenv.lib.optionalString withPulseAudio "pulseaudio_backend,"}${stdenv.lib.optionalString withPortAudio "portaudio_backend,"}"
24+ ];
25+
26+ nativeBuildInputs = [ pkgconfig ];
27+
28+ buildInputs = [ openssl ]
29+ ++ stdenv.lib.optional withALSA alsaLib
30+ ++ stdenv.lib.optional withPulseAudio libpulseaudio
31+ ++ stdenv.lib.optional withPortAudio portaudio;
32+
33+ meta = with stdenv.lib; {
34+ description = "An open source Spotify client running as a UNIX daemon";
35+ homepage = "https://github.com/Spotifyd/spotifyd";
36+ license = with licenses; [ gpl3 ];
37+ maintainers = [ maintainers.anderslundstedt ];
38+ platforms = platforms.unix;
39+ };
40+}
pkgs/top-level/all-packages.nix+6
@@ -18538,6 +18538,12 @@ in
1853818538
1853918539 spectral = qt5.callPackage ../applications/networking/instant-messengers/spectral { };
1854018540
18541+ spotifyd = callPackage ../applications/audio/spotifyd {
18542+ withALSA = stdenv.isLinux;
18543+ withPulseAudio = config.pulseaudio or true;
18544+ withPortAudio = stdenv.isDarwin;
18545+ };
18546+
1854118547 super-productivity = callPackage ../applications/networking/super-productivity { };
1854218548
1854318549 wlc = callPackage ../development/libraries/wlc { };