mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-21 23:54:22 +01:00
Add FTB integrations
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
bd556bcc11
commit
e2fc3e885e
|
@ -73,6 +73,7 @@
|
|||
nixng/containers/syncthing
|
||||
nixng/containers/minecraft/vanilla
|
||||
nixng/containers/minecraft/ftb-infinity
|
||||
nixng/containers/minecraft/ftb-integrations
|
||||
|
||||
overlays/udp-over-tcp.nix
|
||||
overlays/emacsclient-remote
|
||||
|
|
|
@ -3,7 +3,8 @@ let
|
|||
inherit (lib)
|
||||
concatStringsSep
|
||||
getExe
|
||||
flip;
|
||||
flip
|
||||
singleton;
|
||||
|
||||
combineWines = wines:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
|
@ -58,7 +59,20 @@ in
|
|||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
prismlauncher
|
||||
(prismlauncher.override {
|
||||
jdks = with pkgs; [
|
||||
jdk8
|
||||
jdk11
|
||||
jdk17
|
||||
];
|
||||
prismlauncher-unwrapped =
|
||||
(prismlauncher-unwrapped.overrideAttrs (old: {
|
||||
patches = singleton (pkgs.fetchurl {
|
||||
url = "https://github.com/PrismLauncher/PrismLauncher/commit/603b38fa46dc61c0c5ae10a3754bcacb0201d881.diff";
|
||||
sha256 = "sha256-Q/WkDVIvlYu6lkRPjoYZOUif0TPUT6Mmxd1JR4pgdLI=";
|
||||
});
|
||||
}));
|
||||
})
|
||||
|
||||
dejavu_fonts
|
||||
alacritty
|
||||
|
|
30
nixng/containers/minecraft/ftb-integrations/default.nix
Normal file
30
nixng/containers/minecraft/ftb-integrations/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
flake.nixngConfigurations.minecraft-ftb-integrations = inputs.nixng.nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-minecraft";
|
||||
inherit (inputs) nixpkgs;
|
||||
config =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
disabledModules = [ "${inputs.nixng}/modules/services/minecraft.nix" ];
|
||||
imports = [ ../../../modules/minecraft-forge.nix ../../../modules/minecraft.nix ];
|
||||
dumb-init = {
|
||||
enable = true;
|
||||
type.services = {};
|
||||
};
|
||||
|
||||
services.minecraft.forge = {
|
||||
enable = true;
|
||||
|
||||
modpackId = 107;
|
||||
versionId = 6572;
|
||||
modpacksChHash = "sha256-YZATEoypF+H00KuJAOdsk1Kw1aWPS1y803GKGi7Tv7Y=";
|
||||
|
||||
javaPackage = pkgs.jdk11;
|
||||
|
||||
eulaAccept = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -19,6 +19,11 @@ in
|
|||
type = types.str;
|
||||
};
|
||||
|
||||
javaPackage = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.jdk17;
|
||||
};
|
||||
|
||||
serverPackage = mkOption {
|
||||
type = types.package;
|
||||
readOnly = true;
|
||||
|
@ -36,6 +41,11 @@ in
|
|||
type = with types; listOf str;
|
||||
default = [];
|
||||
};
|
||||
|
||||
extraFixup = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -61,12 +71,18 @@ in
|
|||
'';
|
||||
|
||||
installPhase = ''
|
||||
./modpacks.ch ${toString cfg.modpackId} ${toString cfg.versionId} --auto --nojava --path $out
|
||||
mkdir bin
|
||||
ln -s ${pkgs.writeShellScript "noop" ''echo "cd $PWD ; java $@" > install-forge''} bin/java
|
||||
export PATH=$PWD/bin:$PATH
|
||||
|
||||
./modpacks.ch ${toString cfg.modpackId} ${toString cfg.versionId} --nojava --path $out --verbose
|
||||
'';
|
||||
|
||||
fixupPhase = ''
|
||||
# delete useless non-reproducible data that we really don't need. A less "shotgun" cleaning is possible
|
||||
rm $out/version.json
|
||||
|
||||
${cfg.extraFixup}
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
@ -80,7 +96,7 @@ in
|
|||
mkdir -p $out/bin
|
||||
|
||||
cp ${pkgs.writeShellScript "server.sh" ''
|
||||
export PATH=${makeBinPath (with pkgs; [ coreutils findutils bash ])}:$PATH
|
||||
export PATH=${makeBinPath (with pkgs; [ coreutils findutils bash cfg.javaPackage ])}:$PATH
|
||||
export _path=$PWD
|
||||
echo $0
|
||||
|
||||
|
@ -133,9 +149,11 @@ in
|
|||
find ${forgeFod} -type f -printf '%P\n' | tr '\n' '\0' | xargs -0 -I {} sh -c 'linkFile "$1"' sh {} # mkdir -p "$_path/$(dirname "$1")" ; ln -s "${forgeFod}/$1" "$_path/$1"
|
||||
|
||||
ln -s ${pkgs.writeShellScript "start.sh" ''
|
||||
${lib.getExe pkgs.jdk8} $(cat ${forgeFod}/start.sh | grep -e "java" -e jar | sed 's/^"java" \(.*\) -jar .*$/\1/') "$@" -jar forge-*.jar
|
||||
${lib.getExe cfg.javaPackage} $(cat ${forgeFod}/start.sh | grep -e "java" -e jar | sed 's/^"java" \(.*\) -jar .*$/\1/') "$@" -jar forge-*.jar
|
||||
''} $_path/start.sh
|
||||
|
||||
# [ -f $_path/install-forge ] && bash install-forge
|
||||
|
||||
$_path/start.sh
|
||||
''} $out/bin/server
|
||||
'';
|
||||
|
@ -148,7 +166,7 @@ in
|
|||
mkdir -p /var/lib/minecraft/forge
|
||||
cd /var/lib/minecraft/forge
|
||||
echo "eula=true" > eula.txt
|
||||
${cfg.serverPackage}/bin/server ${concatMapStringsSep " " (x: ''"${x}"'') cfg.extraJavaArguments}
|
||||
${pkgs.bash}/bin/bash -x ${cfg.serverPackage}/bin/server ${concatMapStringsSep " " (x: ''"${x}"'') cfg.extraJavaArguments}
|
||||
'';
|
||||
enabled = true;
|
||||
};
|
||||
|
|
24
terranix/containers/minecraft/ftb-integrations/default.nix
Normal file
24
terranix/containers/minecraft/ftb-integrations/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ config', pkgs, elib, vars, ... }:
|
||||
let
|
||||
inherit (elib)
|
||||
nfsVolume
|
||||
nomadJob;
|
||||
in
|
||||
{
|
||||
resource."nomad_volume"."minecraft-ftb-integrations" = nfsVolume {
|
||||
access_mode = "single-node-writer";
|
||||
volume_name = "minecraft-ftb-integrations";
|
||||
server = "blowhole.hosts.in.redalder.org";
|
||||
share = "/mnt/kyle/infrastructure/minecraft/ftb-integrations";
|
||||
mount_flags = [ "hard" "vers=4.2" "rsize=131072" "wsize=131072" "async" ];
|
||||
};
|
||||
|
||||
resource."nomad_job"."minecraft-ftb-integrations" = nomadJob {
|
||||
jobspec = ./job.hcl;
|
||||
vars = {
|
||||
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
|
||||
flake_sha = vars.flake_sha;
|
||||
store_path = config'.flake.nixngConfigurations.minecraft-ftb-integrations.config.system.build.toplevel;
|
||||
};
|
||||
};
|
||||
}
|
62
terranix/containers/minecraft/ftb-integrations/job.hcl
Normal file
62
terranix/containers/minecraft/ftb-integrations/job.hcl
Normal file
|
@ -0,0 +1,62 @@
|
|||
variable "flake_ref" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "flake_sha" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "store_path" {
|
||||
type = string
|
||||
}
|
||||
|
||||
job "minecraft-ftb-integrations" {
|
||||
datacenters = [ "homelab-1" ]
|
||||
type = "service"
|
||||
|
||||
group "minecraft-ftb-integrations" {
|
||||
count = 1
|
||||
|
||||
volume "minecraft-ftb-integrations" {
|
||||
type = "csi"
|
||||
source = "minecraft-ftb-integrations"
|
||||
read_only = false
|
||||
|
||||
attachment_mode = "file-system"
|
||||
access_mode = "single-node-writer"
|
||||
}
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
port "minecraft" {
|
||||
static = 25562
|
||||
to = 25565
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task "minecraft-ftb-integrations" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.minecraft-ftb-integrations.config.system.build.toplevel"
|
||||
nix_flake_sha = var.flake_sha
|
||||
nix_flake_store_path = var.store_path
|
||||
entrypoint = [ "init" ]
|
||||
|
||||
ports = ["minecraft"]
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 4096
|
||||
memory = 6500
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "minecraft-ftb-integrations"
|
||||
destination = "/var/lib/minecraft/forge"
|
||||
read_only = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -111,6 +111,11 @@ in
|
|||
source = ./containers/minecraft/ftb-infinity;
|
||||
};
|
||||
|
||||
module."minecraft-ftb-integrations" = elib.terraformModule {
|
||||
name = "nfs-csi";
|
||||
source = ./containers/minecraft/ftb-integrations;
|
||||
};
|
||||
|
||||
module."altra" = elib.terraformModule {
|
||||
name = "altra";
|
||||
source = ./altra.nix;
|
||||
|
|
Loading…
Reference in a new issue