fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
1.0 KiB50 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.programs.ncspot;
8
9  tomlFormat = pkgs.formats.toml { };
10
11in {
12  meta.maintainers = [ ];
13
14  options.programs.ncspot = {
15    enable = mkEnableOption "ncspot";
16
17    package = mkOption {
18      type = types.package;
19      default = pkgs.ncspot;
20      defaultText = literalExpression "pkgs.ncspot";
21      description = "The package to use for ncspot.";
22    };
23
24    settings = mkOption {
25      type = tomlFormat.type;
26      default = { };
27      example = literalExpression ''
28        {
29          shuffle = true;
30          gapless = true;
31        }
32      '';
33      description = ''
34        Configuration written to
35        {file}`$XDG_CONFIG_HOME/ncspot/config.toml`.
36
37        See <https://github.com/hrkfdn/ncspot#configuration>
38        for the full list of options.
39      '';
40    };
41  };
42
43  config = mkIf cfg.enable {
44    home.packages = [ cfg.package ];
45
46    xdg.configFile."ncspot/config.toml" = mkIf (cfg.settings != { }) {
47      source = tomlFormat.generate "ncspot-config" cfg.settings;
48    };
49  };
50}