musicutil/hm-module.nix

43 lines
865 B
Nix
Raw Normal View History

2022-02-22 14:02:58 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.musicutil;
yamlFormat = pkgs.formats.yaml { };
in {
options = {
programs.musicutil = {
enable = mkOption {
type = types.bool;
default = false;
};
package = mkOption {
2022-02-22 14:18:51 +00:00
type = types.package;
default = pkgs.musicutil;
2022-02-22 14:02:58 +00:00
};
settings = {
2022-02-22 14:20:46 +00:00
log_level = mkOption {
2022-02-22 14:02:58 +00:00
type = types.str;
default = "info";
};
2022-02-22 14:20:46 +00:00
cache = mkOption {
type = types.bool;
default = false;
};
cache_dir = mkOption {
2022-02-22 14:24:20 +00:00
type = types.str;
default = "source_dir";
2022-02-22 14:20:46 +00:00
};
2022-02-22 14:02:58 +00:00
};
};
};
config = mkIf cfg.enable {
2022-02-22 14:18:51 +00:00
home.packages = [ cfg.package ];
2022-02-22 14:02:58 +00:00
xdg.configFile."musicutil.yaml".source =
yamlFormat.generate "musicutil-config" cfg.settings;
};
}