nixos-configs/configurations/nos/modules/docker/music/jbots/images/jmusicbot.nix
matt1432 6ca0d7248b
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: rename some flake attr directories
2024-12-16 15:51:41 -05:00

43 lines
1.2 KiB
Nix

# Locked
pkgs: let
dname = "jmusicbot-docker";
dtag = pkgs.jmusicbot.version;
jre_modules = [
"java.se"
"jdk.crypto.cryptoki"
];
jre =
(pkgs.jre_minimal.overrideAttrs {
buildPhase = ''
runHook preBuild
# further optimizations for image size https://github.com/NixOS/nixpkgs/issues/169775
jlink --module-path ${pkgs.jdk11_headless}/lib/openjdk/jmods --add-modules ${pkgs.lib.concatStringsSep "," jre_modules} --no-header-files --no-man-pages --compress=2 --output $out
runHook postBuild
'';
})
.override {jdk = pkgs.jdk11_headless;};
jmusicbot =
(pkgs.jmusicbot.overrideAttrs rec {
version = "0.4.3.2";
src = pkgs.fetchurl {
url = "https://github.com/xPrinny/MusicBot/releases/download/${version}/JMusicBot-${version}.jar";
sha256 = "sha256-MEOWppkw74s81D1EJEqZMjOzDlLdH6uyanDZD5d+Xa4=";
};
meta.platforms = ["x86_64-linux"];
})
.override {jre_headless = jre;};
in
pkgs.dockerTools.buildLayeredImage {
name = dname;
tag = dtag;
config = {
created = "now";
Cmd = ["${jmusicbot}/bin/JMusicBot"];
WorkingDir = "/jmb/config";
Volumes."/jmb/config" = {};
};
}