ark/users/modules/musikcubed/default.nix

40 lines
982 B
Nix
Raw Normal View History

2023-05-09 02:58:14 +03:00
{
config,
lib,
pkgs,
...
}: let
2023-05-08 23:09:44 +03:00
cfg = config.services.musikcubed;
in {
options = {
services.musikcubed = {
enable = lib.mkEnableOption "whether to enable musikcubed";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.musikcube;
};
settings = lib.mkOption {
type = (pkgs.formats.json {}).type;
default = builtins.fromJSON (builtins.readFile ./default-config.json);
};
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.musikcubed = {
2023-09-10 21:40:39 +03:00
# Install = {
# WantedBy = ["default.target"];
# };
2023-05-08 23:09:44 +03:00
Unit = {
Description = "musikcubed";
After = "network.target";
};
Service = {
ExecStart = "${cfg.package}/bin/musikcubed --foreground";
Restart = "on-failure";
RestartSec = 5;
};
};
xdg.configFile."musikcube/plugin_musikcubeserver(wss,http).json".text = builtins.toJSON cfg.settings;
};
}