about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-01-05 09:45:29 +0900
committersefidel <contact@sefidel.net>2022-01-05 09:45:29 +0900
commit2e547fbe9a6703fa9f831247250c5e9a1da0b811 (patch)
treeff2a37af778ee03241974fb34f4c32d02188979f
parentaf5ed2405ccdecbd0fe1b34e2b98a5b6ecc86428 (diff)
downloadnixrc-2e547fbe9a6703fa9f831247250c5e9a1da0b811.tar.gz
nixrc-2e547fbe9a6703fa9f831247250c5e9a1da0b811.zip
home/programs: add module 'spotify-tui'
-rw-r--r--home/modules/default.nix1
-rw-r--r--home/modules/profiles/multimedia/default.nix16
-rw-r--r--home/modules/programs/spotify-tui/default.nix56
3 files changed, 73 insertions, 0 deletions
diff --git a/home/modules/default.nix b/home/modules/default.nix
index 91fd11f..b096729 100644
--- a/home/modules/default.nix
+++ b/home/modules/default.nix
@@ -9,6 +9,7 @@
 
   "programs/nixpkgs" = import ./programs/nixpkgs;
   "programs/zshell" = import ./programs/zshell;
+  "programs/spotify-tui" = import ./programs/spotify-tui;
 
   "misc/home" = import ./misc/home;
   "misc/neotheme" = import ./misc/neotheme;
diff --git a/home/modules/profiles/multimedia/default.nix b/home/modules/profiles/multimedia/default.nix
index 133adc7..4f48d00 100644
--- a/home/modules/profiles/multimedia/default.nix
+++ b/home/modules/profiles/multimedia/default.nix
@@ -22,5 +22,21 @@ in
         };
       };
     };
+
+    programs.spotify-tui = {
+      enable = true;
+
+      settings = {
+        theme = {
+          active = "Cyan";
+          banner = "LightCyan";
+        };
+
+        behavior = {
+          seek_milliseconds = 5000;
+          volume_increment = 10;
+        };
+      };
+    };
   };
 }
diff --git a/home/modules/programs/spotify-tui/default.nix b/home/modules/programs/spotify-tui/default.nix
new file mode 100644
index 0000000..433ba64
--- /dev/null
+++ b/home/modules/programs/spotify-tui/default.nix
@@ -0,0 +1,56 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  cfg = config.programs.spotify-tui;
+  yamlFormat = pkgs.formats.yaml { };
+
+in {
+  meta.maintainers = with lib.maintainers; [ boppyt ];
+
+  options.programs.spotify-tui = {
+    enable = mkEnableOption "A Spotify client for the terminal written in Rust.";
+
+    package = mkOption {
+      type = types.package;
+      default = pkgs.spotify-tui;
+      defaultText = literalExpression "pkgs.spotify-tui";
+      description = "The spotify-tui package to install";
+    };
+
+    settings = mkOption {
+      type = yamlFormat.type;
+      default = { };
+      description = ''
+        Configuration written to
+        <filename>$XDG_CONFIG_HOME/spotify-tui/config.yml</filename>. See <link
+        xlink:href="https://github.com/Rigellute/spotify-tui#configuration"/>
+        for a list of available options.
+      '';
+      example = literalExpression ''
+        {
+          theme = {
+            active = "Cyan";
+            banner = "LightCyan";
+          };
+
+          behavior = {
+            seek_milliseconds = 5000;
+            volume_increment = 10;
+          };
+        }
+      '';
+    };
+  };
+
+  config = mkIf cfg.enable {
+
+    home.packages = [ cfg.package ];
+
+    xdg.configFile."spotify-tui/config.yml" = mkIf (cfg.settings != { }) {
+      source = yamlFormat.generate "config.yml" cfg.settings;
+    };
+  };
+}