Install spotifyd
- Spotifyd is a program used to play music from spotify lightweightly in the
background
- I use SOPS to store my spotify password: spotifyd needs a premium account to
work
diff --git a/modules/spotify.nix b/modules/spotify.nix
new file mode 100644
index 0000000..b9e591c
--- /dev/null
+++ b/modules/spotify.nix
@@ -0,0 +1,39 @@
+{
+ pkgs,
+ config,
+ home,
+ username,
+ ...
+}: {
+ home.services.spotifyd = {
+ enable = true;
+ settings = {
+ global = {
+ username_cmd = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.spotifyUsername.path}";
+ password_cmd = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.spotifyPassword.path}";
+ use_mpris = true;
+ device_name = "background@${config.networking.hostName}";
+ cache_path = "${home.home.homeDirectory}/.cache/spotifyd";
+ max_cache_size = 1000000000;
+ volume_normalisation = true;
+ normalisation_pregain = -10;
+ autoplay = true;
+ zeroconf_port = 1234;
+ device_type = "computer";
+ };
+ };
+ };
+ config = {
+ sops.secrets.spotifyUsername = {
+ mode = "0400";
+ owner = config.users.users.${username}.name;
+ group = config.users.users.nobody.group;
+ };
+ sops.secrets.spotifyPassword = {
+ mode = "0400";
+ owner = config.users.users.${username}.name;
+ group = config.users.users.nobody.group;
+ };
+ environment.persistence."/nix/persist".users.${username}.directories = [".cache/spotifyd"];
+ };
+}