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-11-11 18:39:26 +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;
|
|
|
|
};
|
|
|
|
}
|