1{
2 config,
3 pkgs,
4 lib,
5 ...
6}:
7let
8 cfg = config.programs.musikcube;
9in
10{
11 options = {
12 programs.musikcube = {
13 enable = lib.mkEnableOption "whether to enable musikcube";
14 package = lib.mkOption {
15 type = lib.types.package;
16 default = pkgs.musikcube;
17 };
18 settings = lib.mkOption {
19 type = (pkgs.formats.json { }).type;
20 default = builtins.fromJSON (builtins.readFile ./default-config.json);
21 };
22 };
23 };
24
25 config = lib.mkIf cfg.enable {
26 home.packages = [ cfg.package ];
27 home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = [
28 ".config/musikcube"
29 ];
30 xdg.configFile."musikcube/settings.json".text = builtins.toJSON cfg.settings;
31 };
32}