Files
home-manager/modules/programs/ncspot.nix
Austin Horstman 01ea51d706 treewide: use inherit for attribute assignments
This change converts redundant attribute assignments of the form `a =
a;` or `a = someSet.a;` into cleaner `inherit` statements. This reduces
verbosity and follows common Nix style for bringing attributes into
scope.

Statix Codes: W03 (manual_inherit), W04 (manual_inherit_from)

Also include statix and the rule in our configuration.
2026-04-08 14:47:48 -05:00

49 lines
1015 B
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkIf;
cfg = config.programs.ncspot;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = [ lib.maintainers.da157 ];
options.programs.ncspot = {
enable = lib.mkEnableOption "ncspot";
package = lib.mkPackageOption pkgs "ncspot" { nullable = true; };
settings = lib.mkOption {
inherit (tomlFormat) type;
default = { };
example = lib.literalExpression ''
{
shuffle = true;
gapless = true;
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/ncspot/config.toml`.
See <https://github.com/hrkfdn/ncspot#configuration>
for the full list of options.
'';
};
};
config = mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."ncspot/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "ncspot-config" cfg.settings;
};
};
}