From a59be3f3987c51bf73d958d8665b1e01d2872a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 20 May 2020 00:06:26 +0200 Subject: [PATCH] feat: spotifyd, spotify-tui --- configs/default.nix | 1 + configs/packages/default.nix | 1 - configs/spotify.nix | 21 +++++++++++++++++++++ lib/default.nix | 4 ++-- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 configs/spotify.nix diff --git a/configs/default.nix b/configs/default.nix index a3dfec0..350b135 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -40,6 +40,7 @@ in ./redshift.nix ./retiolum.nix ./rofi.nix + ./spotify.nix ./ssh.nix ./sudo.nix ./sxiv.nix diff --git a/configs/packages/default.nix b/configs/packages/default.nix index 0b6e731..038b739 100644 --- a/configs/packages/default.nix +++ b/configs/packages/default.nix @@ -102,7 +102,6 @@ in inkscape pdfgrep # search in pdf pdftk # pdf toolkit - spotify nur.repos.kmein.python3Packages.spotify-cli-linux youtubeDL bc # calculator diff --git a/configs/spotify.nix b/configs/spotify.nix new file mode 100644 index 0000000..5ef488e --- /dev/null +++ b/configs/spotify.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, ... }: +let + inherit (import { inherit pkgs; }) toTOML; + inherit (lib.strings) fileContents; +in +{ + environment.systemPackages = with pkgs; [ + spotify + spotify-tui + ]; + + services.spotifyd = { + enable = true; + config = toTOML { + global = { + username = fileContents ; + password_cmd = "${pkgs.pass}/bin/pass shared/spotify/password"; + }; + }; + }; +} diff --git a/lib/default.nix b/lib/default.nix index 7941883..1ad2d60 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: -{ +rec { writeTOML = object: pkgs.runCommand "generated.toml" {} '' echo '${builtins.toJSON object}' | ${pkgs.remarshal}/bin/json2toml > $out ''; - toTOML = object: builtins.readFile (pkgs.writeTOML object); + toTOML = object: builtins.readFile (writeTOML object); }