From 18e5839ea8722f6aceb967e8e00b3dcf528e6de2 Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Sat, 25 Jun 2022 01:07:03 +0100 Subject: [PATCH] Set up spotifyd with spotify-qt --- hosts/common/graphical/default.nix | 6 ++++++ secrets/secrets.nix | 1 + secrets/spotify_pass.age | 18 ++++++++++++++++ users/daniel/configs/desktop/default.nix | 1 + users/daniel/configs/desktop/i3/default.nix | 5 ++++- .../configs/desktop/i3status-rust/default.nix | 2 +- .../configs/desktop/spotify/default.nix | 21 +++++++++++++++++++ users/daniel/default.nix | 1 + 8 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 secrets/spotify_pass.age create mode 100644 users/daniel/configs/desktop/spotify/default.nix diff --git a/hosts/common/graphical/default.nix b/hosts/common/graphical/default.nix index 010d5f6..4f23d1a 100644 --- a/hosts/common/graphical/default.nix +++ b/hosts/common/graphical/default.nix @@ -12,6 +12,12 @@ networking.networkmanager.enable = true; programs.nm-applet.enable = true; + # A bit confusing but this is required for the home-manager spotifyd :/ + age.secrets.spotify_pass = { + file = ../../../secrets/spotify_pass.age; + owner = config.users.users.daniel.name; + }; + services = { gnome.gnome-keyring.enable = true; diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 15a45be..ea3cebf 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -11,6 +11,7 @@ let system2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDwfy5oG1heHoQlZgrTxqlW+oOTB8NdNcNm1IpKyqfIA root@nixos"; systems = [system1 system2]; in { + "spotify_pass.age".publicKeys = systems ++ users; "rclone_password1.age".publicKeys = [user4 system2]; "rclone_password2.age".publicKeys = [user4 system2]; "dungflix_bucket_account_id.age".publicKeys = [user4 system2]; diff --git a/secrets/spotify_pass.age b/secrets/spotify_pass.age new file mode 100644 index 0000000..243951a --- /dev/null +++ b/secrets/spotify_pass.age @@ -0,0 +1,18 @@ +age-encryption.org/v1 +-> ssh-ed25519 SukvQA pg/PAlDK4u7hUBGCWy/DcsgmNx5EItHOuUtxWLwJeFo +tEjr3jiRsNgDR+ygfq5mtO/n5yOaJKjhAIvtCbNbNUo +-> ssh-ed25519 GzHGXw OumojtCAEXpYNofHQsu/Pp0gPwBaX1kJxmu1aTbXbVc +YSalCfhAWQbd0tmSTb5ZvBtIJhi7JHhF4eUsiFE4anM +-> ssh-ed25519 eYYv1Q jYHxI/iaEOUvbK74hcCnE3+5vUktYhW7uEOJMB8cpT8 +9NnopXUBDKfn+Ece0qIYVUWeA5WcuJUKse7OcXOH5Ss +-> ssh-ed25519 Bp5IaA r3eCw5PzJXMlgunlPDL4CRDAsnuGkHMHjEe4J6NbKH4 +AskQ1RBBrcBTo1wKK1xN57kf7znV2eQxngaiJSKButM +-> ssh-ed25519 T/DpgA rGIlJTUCplaLp9J0i7VEdQgOVFgEFLmaDV1HJE4Ysys +vS3+yjscM30wzDpK/Nw/f7j0clPysnrWCrM8/9MQ8vQ +-> ssh-ed25519 qMgRFg kQsnSSzw8m1SCFlBYA3YlRUaJbKe8sWhnUp+hHO4wlw +v49s0QbsVsUUH795fuY/yvSLl+pN7QaG67fRv3y1luk +-> G{-grease +dfLigYlXuzgNVl+bYuLWYGMoFGdWIu92sAmBR9L2LxeQhlHIDE77RQiuqgiKiLlh +xoif51stfS5BNWXBfi71qudhhRK4sheyi6B8yMXGFnI +--- jXZppNsn5VlJ0g1ODbnSRDtPVCo+5Ky+JXyavAAqddM +¢ä³ÌVÐ/ÁSíÏ>NM„S´·8±ÕÑÒÂĦ a‡VÍ3‘" &zJ1¯5 \ No newline at end of file diff --git a/users/daniel/configs/desktop/default.nix b/users/daniel/configs/desktop/default.nix index 430dc1a..f085b62 100644 --- a/users/daniel/configs/desktop/default.nix +++ b/users/daniel/configs/desktop/default.nix @@ -3,6 +3,7 @@ ./i3 ./i3status-rust # ./polybar + ./spotify ./rofi ]; } diff --git a/users/daniel/configs/desktop/i3/default.nix b/users/daniel/configs/desktop/i3/default.nix index 856bf01..a380142 100644 --- a/users/daniel/configs/desktop/i3/default.nix +++ b/users/daniel/configs/desktop/i3/default.nix @@ -199,7 +199,10 @@ in { } { command = "move scratchpad"; - criteria = {instance = "spotify";}; + criteria = { + instance = "spotify"; + window_type = "normal"; + }; } ]; }; diff --git a/users/daniel/configs/desktop/i3status-rust/default.nix b/users/daniel/configs/desktop/i3status-rust/default.nix index 10891a4..61fa53c 100644 --- a/users/daniel/configs/desktop/i3status-rust/default.nix +++ b/users/daniel/configs/desktop/i3status-rust/default.nix @@ -38,7 +38,7 @@ } { block = "music"; - player = "spotify"; + player = "spotifyd"; buttons = ["prev" "play" "next"]; } { diff --git a/users/daniel/configs/desktop/spotify/default.nix b/users/daniel/configs/desktop/spotify/default.nix new file mode 100644 index 0000000..96afb86 --- /dev/null +++ b/users/daniel/configs/desktop/spotify/default.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + pkgs, + ... +}: { + services.spotifyd = { + enable = true; + package = pkgs.spotifyd.override {withMpris = true;}; + settings = { + global = { + username = "me@danielpatterson.dev"; + password_cmd = "cat /run/agenix/spotify_pass"; + + initial_volume = "70"; + + device_type = "computer"; + }; + }; + }; +} diff --git a/users/daniel/default.nix b/users/daniel/default.nix index 3a35156..d6a46e3 100644 --- a/users/daniel/default.nix +++ b/users/daniel/default.nix @@ -58,6 +58,7 @@ pamixer pavucontrol playerctl + spotify-qt spotify xclip ];