From b99c047395f9332a3a86cfa18959fa35e7bb5205 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Thu, 22 Jun 2023 11:15:08 +0200 Subject: [PATCH] swap jmusicbot to gmusicbot --- hosts/lucent-firepit/default.nix | 6 +++-- modules/services/jmusicbot.nix | 12 +++++++++- packages/gmusicbot.maven.nix | 38 ++++++++++++++++++++++++++++++++ packages/gmusicbot.nix | 32 +++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 packages/gmusicbot.maven.nix create mode 100644 packages/gmusicbot.nix diff --git a/hosts/lucent-firepit/default.nix b/hosts/lucent-firepit/default.nix index 57a9834..e367c90 100644 --- a/hosts/lucent-firepit/default.nix +++ b/hosts/lucent-firepit/default.nix @@ -192,13 +192,15 @@ in { forceskip = [ "fs" ]; movetrack = [ "move" "m" ]; }; + + queuetype = "REGULAR"; }; in { enable = true; instances = { "jomble" = { enable = true; - package = pkgs.unstable.jmusicbot; + package = pkgs._.gmusicbot; options = baseOptions // { token = lib.removeSuffix "\n" (builtins.readFile /etc/jomble_token); @@ -207,7 +209,7 @@ in { }; "jillo" = { enable = true; - package = pkgs.unstable.jmusicbot; + package = pkgs._.gmusicbot; options = baseOptions // { token = lib.removeSuffix "\n" (builtins.readFile /etc/jillo_token); diff --git a/modules/services/jmusicbot.nix b/modules/services/jmusicbot.nix index b2442fb..b515041 100644 --- a/modules/services/jmusicbot.nix +++ b/modules/services/jmusicbot.nix @@ -270,6 +270,16 @@ in { }; }; + queuetype = mkOption { + type = types.enum ["FAIR" "REGULAR"]; + description = '' + Sets the queue type + FAIR: Each user gets a fair chance at the queue by rearranging it such that no user can fill it up entirely + REGULAR: Queue works as first-come, first-served + ''; + default = "FAIR"; + }; + eval = mkOption { type = types.bool; description = '' @@ -359,4 +369,4 @@ in { } ) cfg.instances; }; -} \ No newline at end of file +} diff --git a/packages/gmusicbot.maven.nix b/packages/gmusicbot.maven.nix new file mode 100644 index 0000000..c1065f1 --- /dev/null +++ b/packages/gmusicbot.maven.nix @@ -0,0 +1,38 @@ +{ lib, pkgs }: + +let + shade_1_5 = map (obj: pkgs.javaPackages.fetchMaven { + version = "1.5"; + artifactId = "maven-shade-plugin"; + groupId = "org.apache.maven.plugins"; + sha512 = obj.sha512; + type = obj.type; + }) [ + { type = "jar"; sha512 = "sha512-AoBtMzmqWMiOz5CSzl6ucYXK2iPtYbSlbsa2f8gCeP9ZtZfM+LkrEVzF9JcWsn+qbA9zC84O0fUyt7fJl8ZrBg=="; } + { type = "pom"; sha512 = "sha512-YJTFhsAs3hV26L0+fAStwY6AHnPx6+cCo6yP/ZJTOUZvrlNTA1qxP/aBYjhPX3IvQ+UhagwdrSbA4uIS3w5sUw=="; } + ]; +in pkgs.javaPackages.mavenbuild rec { + version = "2023-05-19"; + name = "gmusicbot-${version}"; + + mavenDeps = [ + shade_1_5 + ]; + m2Path = "/jmusicbot/jmusicbot/${version}"; + + src = pkgs.fetchFromGitea { + domain = "git.oat.zone"; + owner = "oat"; + repo = "GMusicBot"; + rev = "master"; + sha256 = "sha256-+sH5LI7PUN25rR1DM529Ly0WPHB4/JIQAPxWi0IlsZ4="; + }; + + meta = with pkgs.lib; { + description = "Discord music bot that's easy to set up and run yourself"; + homepage = "https://git.oat.zone/oat/GMusicBot"; + sourceProvenance = with sourceTypes; [ binaryBytecode ]; + license = licenses.asl20; + inherit (pkgs.jre_headless.meta) platforms; + }; +} diff --git a/packages/gmusicbot.nix b/packages/gmusicbot.nix new file mode 100644 index 0000000..8890f4b --- /dev/null +++ b/packages/gmusicbot.nix @@ -0,0 +1,32 @@ +{ stdenv, lib, fetchurl, makeWrapper, jre_headless }: + +stdenv.mkDerivation rec { + pname = "GMusicBot"; + version = "2023-05-19"; + + src = fetchurl { + url = "https://oat.zone/f/GMusicBot-2023-05-19.jar?v=3"; + sha256 = "sha256-5c36did0kkaeu4Yi9vGIhlqRoeUBBRWKdihbaW9lwk4="; + }; + + dontUnpack = true; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/lib + cp $src $out/lib/GMusicBot + + makeWrapper ${jre_headless}/bin/java $out/bin/GMusicBot \ + --add-flags "-Xmx1G -Dnogui=true -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -jar $out/lib/GMusicBot" + ''; + + meta = with lib; { + description = "Discord music bot that's easy to set up and run yourself"; + homepage = "https://git.oat.zone/oat/GMusicBot"; + sourceProvenance = with sourceTypes; [ binaryBytecode ]; + license = licenses.asl20; + maintainers = with maintainers; [ SuperSandro2000 ]; + inherit (jre_headless.meta) platforms; + }; +}