From 2f857761d0506d3c4c51455aafb1df5180ad7e34 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 1 May 2021 16:38:12 -0500 Subject: [PATCH] ncspot: add module (#1939) * ncspot: add module ncspot is a ncurses Spotify client written in Rust using librespot. * news: fix bad github ui merge Co-authored-by: Nicolas Berbiche --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 ++++++ modules/modules.nix | 1 + modules/programs/ncspot.nix | 50 +++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 modules/programs/ncspot.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9512e28f..882ab0f7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -105,6 +105,8 @@ /tests/modules/programs/ncmpcpp @olmokramer /tests/modules/programs/ncmpcpp-linux @olmokramer +/modules/programs/ncspot.nix @marsam + /modules/programs/ne.nix @cwyc /tests/modules/programs/ne @cwyc diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 4b39a22c..5c570db0 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1946,6 +1946,14 @@ in A new module is available: 'programs.lazygit'. ''; } + + { + time = "2021-04-27T00:00:00+00:00"; + message = '' + A new module is available: 'programs.ncspot'. + ''; + } + ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 0fac1f65..f3c29c86 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -98,6 +98,7 @@ let (loadModule ./programs/msmtp.nix { }) (loadModule ./programs/mu.nix { }) (loadModule ./programs/ncmpcpp.nix { }) + (loadModule ./programs/ncspot.nix { }) (loadModule ./programs/ne.nix { }) (loadModule ./programs/neomutt.nix { }) (loadModule ./programs/neovim.nix { }) diff --git a/modules/programs/ncspot.nix b/modules/programs/ncspot.nix new file mode 100644 index 00000000..ea46c9fc --- /dev/null +++ b/modules/programs/ncspot.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.ncspot; + + tomlFormat = pkgs.formats.toml { }; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.ncspot = { + enable = mkEnableOption "ncspot"; + + package = mkOption { + type = types.package; + default = pkgs.ncspot; + defaultText = literalExample "pkgs.ncspot"; + description = "The package to use for ncspot."; + }; + + settings = mkOption { + type = tomlFormat.type; + default = { }; + example = literalExample '' + { + shuffle = true; + gapless = true; + } + ''; + description = '' + Configuration written to + ~/.config/ncspot/config.toml. + + See + for the full list of options. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."ncspot/config.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "ncspot-config" cfg.settings; + }; + }; +}