Add modrinth-plugin-list.sh, add plugins to paper-vanilla, lock minecraft server to certain version
This commit is contained in:
parent
0c11946ddc
commit
88d5c7bffb
5 changed files with 113 additions and 50 deletions
|
@ -24,16 +24,32 @@
|
|||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
system.autoUpgrade = {
|
||||
enable = true;
|
||||
allowReboot = true;
|
||||
flake = "/etc/nixos";
|
||||
updateFlake = true;
|
||||
failureNotification = {
|
||||
system.autoUpgrade =
|
||||
let
|
||||
plugins = [
|
||||
"9eGKb6K1" # https://modrinth.com/plugin/simple-voice-chat
|
||||
"1u6JkXh5" # https://modrinth.com/plugin/worldedit
|
||||
];
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
ntfyUrlFile = "/etc/secrets/failureNotification.env";
|
||||
allowReboot = true;
|
||||
flake = "/etc/nixos";
|
||||
updateFlake = true;
|
||||
|
||||
extraCommands = ''
|
||||
git stash
|
||||
./modrinth-plugin-list.sh paper 1.20.6 ${builtins.concatStringsSep " " plugins} > paper-vanilla-plugins.nix
|
||||
git add paper-vanilla-plugins.nix
|
||||
git commit -m "Update paper-vanilla-plugins.nix"
|
||||
git stash apply
|
||||
'';
|
||||
|
||||
failureNotification = {
|
||||
enable = true;
|
||||
ntfyUrlFile = "/etc/secrets/failureNotification.env";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
gc = {
|
||||
|
@ -340,8 +356,10 @@
|
|||
paper-vanilla = {
|
||||
enable = true;
|
||||
|
||||
# Pin to specific version of minecraft if you are using plugins, e.g paperServers.paper-1_20_4
|
||||
package = pkgs.paper-server;
|
||||
# When updating minecraft version make sure the plugins will work!
|
||||
symlinks.plugins = pkgs.callPackage ./paper-vanilla-plugins.nix { };
|
||||
package = pkgs.paperServers.paper-1_20_6;
|
||||
|
||||
openFirewall = true;
|
||||
autoStart = true;
|
||||
jvmOpts = "-Xmx2G -Xms1G -Dminecraft.api.env=custom -Dminecraft.api.auth.host=${config.services.drasl.settings.BaseURL}/auth -Dminecraft.api.account.host=${config.services.drasl.settings.BaseURL}/account -Dminecraft.api.session.host=${config.services.drasl.settings.BaseURL}/session -Dminecraft.api.services.host=${config.services.drasl.settings.BaseURL}/services";
|
||||
|
|
84
flake.lock
generated
84
flake.lock
generated
|
@ -1,5 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"buildNodeModules": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"drasl",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1707354861,
|
||||
"narHash": "sha256-L10H5hh9S6y20c7AKuKJ2h9BczODqpTCoGEZBDPJhd0=",
|
||||
"owner": "adisbladis",
|
||||
"repo": "buildNodeModules",
|
||||
"rev": "76c7c56dd9dcea355a8e2ebd0f228a8f2d1e1ee8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "adisbladis",
|
||||
"repo": "buildNodeModules",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"catnip-website": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -21,30 +42,31 @@
|
|||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715847684,
|
||||
"narHash": "sha256-eUhjVSWqZjq7wlpAMsNI313VpAgvNjq38cpXWLyPwnM=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "06a9cdcbec4d33f5fc25d6574a356ac12897545b",
|
||||
"revCount": 21,
|
||||
"lastModified": 1716484261,
|
||||
"narHash": "sha256-/wnZn+zty0axwuC6MQgfhl+eM4GA+NRE9j3Pf10F4do=",
|
||||
"ref": "extraCommands",
|
||||
"rev": "2fad4a13f23d600be66e0a6845428b253af9c64c",
|
||||
"revCount": 26,
|
||||
"type": "git",
|
||||
"url": "https://forge.catnip.ee/batteredbunny/common.nix"
|
||||
},
|
||||
"original": {
|
||||
"ref": "extraCommands",
|
||||
"type": "git",
|
||||
"url": "https://forge.catnip.ee/batteredbunny/common.nix"
|
||||
}
|
||||
},
|
||||
"drasl": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"npmlock2nix": "npmlock2nix"
|
||||
"buildNodeModules": "buildNodeModules",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715736290,
|
||||
"narHash": "sha256-LDQunHhgysRYAsaVfZag8f8WePziCaqPLV36wUvk4lo=",
|
||||
"lastModified": 1716497918,
|
||||
"narHash": "sha256-fNUhiRNQi4mf/B36sPZ4P37AaTxMfykLo/xTtUts6eQ=",
|
||||
"owner": "unmojang",
|
||||
"repo": "drasl",
|
||||
"rev": "25f385ac2c77b6c296da0201bc230ffd328a2827",
|
||||
"rev": "f37e9a5b2b18a912ff97924eb4d5a7e77f8f630d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -131,11 +153,11 @@
|
|||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715822506,
|
||||
"narHash": "sha256-2XbtVeTO+2QsWBJL/kmUJMU18kTFQPEbr3+enIKBUUk=",
|
||||
"lastModified": 1716513728,
|
||||
"narHash": "sha256-yZJebdRQ1UmJ6BMVNRDwwd2ZyBtpxDXsVQixlDe+Ras=",
|
||||
"owner": "Infinidoge",
|
||||
"repo": "nix-minecraft",
|
||||
"rev": "f014a164b1c9eb4cfd8554054f63e02e594c2d72",
|
||||
"rev": "876132681d6c3c2ef74cc9e37c0730e8dfe6ed4d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -146,11 +168,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1715787315,
|
||||
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
|
||||
"lastModified": 1716293225,
|
||||
"narHash": "sha256-pU9ViBVE3XYb70xZx+jK6SEVphvt7xMTbm6yDIF4xPs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
|
||||
"rev": "3eaeaeb6b1e08a016380c279f8846e0bd8808916",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -162,16 +184,16 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1688392541,
|
||||
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
|
||||
"lastModified": 1715218190,
|
||||
"narHash": "sha256-R98WOBHkk8wIi103JUVQF3ei3oui4HvoZcz9tYOAwlk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
|
||||
"rev": "9a9960b98418f8c385f52de3b09a63f9c561427a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.11",
|
||||
"ref": "nixos-23.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
|
@ -209,11 +231,11 @@
|
|||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1715787315,
|
||||
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
|
||||
"lastModified": 1716330097,
|
||||
"narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=",
|
||||
"owner": "Nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
|
||||
"rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -223,22 +245,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"npmlock2nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673447413,
|
||||
"narHash": "sha256-sJM82Sj8yfQYs9axEmGZ9Evzdv/kDcI9sddqJ45frrU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "npmlock2nix",
|
||||
"rev": "9197bbf397d76059a76310523d45df10d2e4ca81",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "npmlock2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"catnip-website": "catnip-website",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
common-modules.url = "git+https://forge.catnip.ee/batteredbunny/common.nix";
|
||||
common-modules.url = "git+https://forge.catnip.ee/batteredbunny/common.nix?ref=extraCommands";
|
||||
drasl.url = "github:unmojang/drasl";
|
||||
};
|
||||
|
||||
|
|
32
modrinth-plugin-list.sh
Executable file
32
modrinth-plugin-list.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash curl jq gnused
|
||||
loader=$1
|
||||
game_version=$2
|
||||
|
||||
echo "# auto generated with modrinth-plugin-list.sh $@"
|
||||
echo "# for usage with nix-minecraft"
|
||||
echo "{ fetchurl, pkgs, ... }: "
|
||||
echo "pkgs.linkFarmFromDrvs \"plugins\" (builtins.attrValues {"
|
||||
|
||||
for project in "${@:3}"
|
||||
do
|
||||
slug=$(curl --no-progress-meter https://api.modrinth.com/v2/project/$project | jq -r '.slug')
|
||||
if [[ $slug == "" ]]; then
|
||||
echo "Invalid project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input=$(curl --no-progress-meter https://api.modrinth.com/v2/project/$project/version?loaders=%5B%22$loader%22%5D&game_versions=%5B%22$game_version%22%5D)
|
||||
|
||||
if [[ $input == "" ]]; then
|
||||
echo "Invalid loader or game version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n " $slug = "
|
||||
echo $input \
|
||||
| jq -c '.[0].files | (.[] | select(.primary == true)) // .[0] | {url: .url, sha512: .hashes.sha512}' \
|
||||
| sed 's/{"url":"\(.\+\)","sha512":"\(.\+\)"}/fetchurl { url = "\1"; sha512 = "\2"; };/'
|
||||
done
|
||||
|
||||
echo "})"
|
7
paper-vanilla-plugins.nix
Normal file
7
paper-vanilla-plugins.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
# auto generated with modrinth-plugin-list.sh paper 1.20.6 9eGKb6K1 1u6JkXh5
|
||||
# for usage with nix-minecraft
|
||||
{ fetchurl, pkgs, ... }:
|
||||
pkgs.linkFarmFromDrvs "plugins" (builtins.attrValues {
|
||||
simple-voice-chat = fetchurl { url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/je8CoE57/voicechat-bukkit-2.5.13.jar"; sha512 = "35a10a3de4a4f173820938484e62d486c9597c5bc4541e88df9bd08d55d059033018903aa4edc4d91333c022615ff10e914a38e6380007c8c0b7ab21b59e9b7b"; };
|
||||
worldedit = fetchurl { url = "https://cdn.modrinth.com/data/1u6JkXh5/versions/j8KJp1Ch/worldedit-bukkit-7.3.1.jar"; sha512 = "0205dfe179ea2a16308def212c336d87540bc7df579d74c7fa47f0c767ed26737664386f838f18cdb1d0a32b57c89d15ca6ededc62c8a2f9fe3f252e55771d4b"; };
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue