add luckperms config
This commit is contained in:
parent
412c8118ab
commit
ecade68be0
3 changed files with 345 additions and 40 deletions
|
@ -4,6 +4,11 @@ let
|
|||
luckperms = pkgs.callPackage ../../packages/minecraft/luckperms.nix { };
|
||||
cfg = config.services.minecraft.luckperms;
|
||||
opt = options.services.minecraft.luckperms;
|
||||
luckperms-yml = pkgs.writeText "luckperms.yml" (generators.toYAML { } cfg.config);
|
||||
startScript = pkgs.writeScript "luckperms" ''
|
||||
mkdir -p plugins/LuckPerms
|
||||
cat ${luckperms-yml} > plugins/LuckPerms/luckperms.yml
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.services.minecraft.luckperms = {
|
||||
|
@ -12,8 +17,290 @@ in
|
|||
type = types.bool;
|
||||
description = "Enable LuckPerms";
|
||||
};
|
||||
|
||||
config = {
|
||||
server = mkOption {
|
||||
default = "global";
|
||||
type = types.str;
|
||||
description = "Server Name to use for LuckPerms";
|
||||
};
|
||||
use-server-uuid-cache = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Use the server UUID cache";
|
||||
};
|
||||
storage-method = mkOption {
|
||||
default = "yaml";
|
||||
type = types.str;
|
||||
description = "Storage method to use for LuckPerms";
|
||||
};
|
||||
sync-minutes = mkOption {
|
||||
default = -1;
|
||||
type = types.int;
|
||||
description = "How often to sync with the database";
|
||||
};
|
||||
watch-files = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Watch for changes";
|
||||
};
|
||||
messaging-service = mkOption {
|
||||
default = "auto";
|
||||
type = types.str;
|
||||
description = "Messaging service to use for LuckPerms";
|
||||
};
|
||||
auto-push-updates = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Automatically push updates to the database";
|
||||
};
|
||||
push-log-entries = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Push log entries to the database";
|
||||
};
|
||||
broadcast-received-log-entries = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Broadcast log entries to the server";
|
||||
};
|
||||
temporary-add-behaviour = mkOption {
|
||||
default = "deny";
|
||||
type = types.enum [ "accumulate" "replace" "deny" ];
|
||||
description = "How to handle temporary permissions";
|
||||
};
|
||||
primary-group-calculation = mkOption {
|
||||
default = "parents-by-weight";
|
||||
type = types.enum [ "stored" "parents-by-weight" "all-parents-by-weight" ];
|
||||
description = "How to calculate the primary group";
|
||||
};
|
||||
argument-based-command-permissions = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Enable argument-based command permissions";
|
||||
};
|
||||
require-sender-group-membership-to-modify = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Require sender group membership to modify permissions";
|
||||
};
|
||||
log-notify = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Log notifications";
|
||||
};
|
||||
log-notify-filtered-descriptions = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
description = "Log filtered descriptions";
|
||||
};
|
||||
auto-install-translations = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Automatically install translations";
|
||||
};
|
||||
inheritance-traversal-algorithm = mkOption {
|
||||
default = "depth-first-pre-order";
|
||||
type = types.enum [ "breadth-first" "depth-first-pre-order" "depth-first-post-order" ];
|
||||
description = "Inheritance traversal algorithm";
|
||||
};
|
||||
post-traversal-inheritance-sort = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Sort post-traversal inheritance";
|
||||
};
|
||||
context-satisfy-mode = mkOption {
|
||||
default = "at-least-one-value-per-key";
|
||||
type = types.enum [ "at-least-one-value-per-key" "all-values-per-key" ];
|
||||
description = "Context satisfy mode";
|
||||
};
|
||||
disabled-contexts = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
description = "Disabled contexts";
|
||||
};
|
||||
include-global = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Include global permissions";
|
||||
};
|
||||
include-global-world = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Include global world permissions";
|
||||
};
|
||||
apply-global-groups = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply global groups";
|
||||
};
|
||||
apply-global-world-groups = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply global world groups";
|
||||
};
|
||||
meta-value-selection-default = mkOption {
|
||||
default = "inheritance";
|
||||
type = types.enum [ "inheritance" "highest-number" "lowest-number" ];
|
||||
description = "Meta value selection default";
|
||||
};
|
||||
meta-value-selection = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf (types.enum [ "inheritance" "highest-number" "lowest-number" ]);
|
||||
description = "Meta value selection";
|
||||
};
|
||||
apply-wildcards = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply wildcards";
|
||||
};
|
||||
apply-sponge-implicit-wildcards = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Apply Sponge implicit wildcards";
|
||||
};
|
||||
apply-default-negated-permissions-before-wildcards = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Apply default negated permissions before wildcards";
|
||||
};
|
||||
apply-regex = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply regex";
|
||||
};
|
||||
apply-shorthand = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply shorthand";
|
||||
};
|
||||
apply-bukkit-child-permissions = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply Bukkit child permissions";
|
||||
};
|
||||
apply-bukkit-default-permissions = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply Bukkit default permissions";
|
||||
};
|
||||
apply-bukkit-attachment-permissions = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Apply Bukkit attachment permissions";
|
||||
};
|
||||
disabled-context-calculators = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
description = "Disabled context calculators";
|
||||
};
|
||||
world-rewrite = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf types.str;
|
||||
description = "World rewrite";
|
||||
};
|
||||
group-weight = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf types.int;
|
||||
description = "Group weight";
|
||||
};
|
||||
enable-ops = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Enable ops";
|
||||
};
|
||||
auto-op = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Automatically op players";
|
||||
};
|
||||
commands-allow-op = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Commands allow op";
|
||||
};
|
||||
vault-unsafe-lookups = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Vault unsafe lookups";
|
||||
};
|
||||
vault-group-use-displaynames = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Vault group use displaynames";
|
||||
};
|
||||
vault-npc-group = mkOption {
|
||||
default = "default";
|
||||
type = types.str;
|
||||
description = "Vault NPC group";
|
||||
};
|
||||
vault-npc-op-status = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Vault NPC op status";
|
||||
};
|
||||
use-vault-server = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Use Vault server";
|
||||
};
|
||||
vault-server = mkOption {
|
||||
default = "global";
|
||||
type = types.str;
|
||||
description = "Vault server";
|
||||
};
|
||||
vault-include-global = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Vault include global";
|
||||
};
|
||||
vault-ignore-world = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Vault ignore world";
|
||||
};
|
||||
debug-logins = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Debug logins";
|
||||
};
|
||||
allow-invalid-usernames = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Allow invalid usernames";
|
||||
};
|
||||
skip-bulkupdate-confirmation = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Skip bulkupdate confirmation";
|
||||
};
|
||||
prevent-primary-group-removal = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Prevent primary group removal";
|
||||
};
|
||||
update-client-command-list = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Update client command list";
|
||||
};
|
||||
register-command-list-data = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = "Register command list data";
|
||||
};
|
||||
resolve-command-selectors = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Resolve command selectors";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
services.minecraft.plugins = [ luckperms ];
|
||||
services.minecraft.plugins = [{
|
||||
package = luckperms;
|
||||
startScript = startScript;
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2441,7 +2441,18 @@ in
|
|||
};
|
||||
plugins = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.package;
|
||||
type = types.listOf (types.submodule {
|
||||
options = {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "Package name of the plugin";
|
||||
};
|
||||
startScript = mkOption {
|
||||
type = types.nullOr (types.oneOf [ types.str types.package ]);
|
||||
description = "Start script of the plugin";
|
||||
};
|
||||
};
|
||||
});
|
||||
description = "List of plugins to load";
|
||||
};
|
||||
};
|
||||
|
@ -2466,32 +2477,39 @@ in
|
|||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = [ papermc ];
|
||||
preStart = ''
|
||||
cd $HOME
|
||||
# Agree to the EULA
|
||||
echo "eula=true" > eula.txt
|
||||
# Update the server properties
|
||||
cat ${serverProperties} > server.properties
|
||||
${if cfg.properties.rcon-password-file != null then ''
|
||||
echo "rcon.password=$(cat ${builtins.toString cfg.properties.rcon-password-file})" >> server.properties
|
||||
'' else "" }
|
||||
# Update the whitelist
|
||||
cat ${whitelistJson} > whitelist.json
|
||||
# Update the bukkit yml
|
||||
cat ${bukkitYaml} > bukkit.yml
|
||||
# Update the spigot yml
|
||||
cat ${spigotYaml} > spigot.yml
|
||||
# Update the paper yml
|
||||
cat ${paperYaml} > paper.yml
|
||||
# Update the plugins
|
||||
mkdir -p plugins
|
||||
rm -rf plugins/*.jar
|
||||
${if cfg.plugins == [] then "" else ''
|
||||
for f in ${builtins.toString cfg.plugins}; do
|
||||
cp $f plugins
|
||||
done
|
||||
''}
|
||||
'';
|
||||
preStart =
|
||||
let
|
||||
plugins = builtins.map
|
||||
(plugin: ''
|
||||
cp ${plugin.package} plugins
|
||||
${if plugin.startScript != null then ''
|
||||
${plugin.startScript}
|
||||
'' else ""}
|
||||
'')
|
||||
cfg.plugins;
|
||||
in
|
||||
''
|
||||
cd $HOME
|
||||
# Agree to the EULA
|
||||
echo "eula=true" > eula.txt
|
||||
# Update the server properties
|
||||
cat ${serverProperties} > server.properties
|
||||
${if cfg.properties.rcon-password-file != null then ''
|
||||
echo "rcon.password=$(cat ${builtins.toString cfg.properties.rcon-password-file})" >> server.properties
|
||||
'' else "" }
|
||||
# Update the whitelist
|
||||
cat ${whitelistJson} > whitelist.json
|
||||
# Update the bukkit yml
|
||||
cat ${bukkitYaml} > bukkit.yml
|
||||
# Update the spigot yml
|
||||
cat ${spigotYaml} > spigot.yml
|
||||
# Update the paper yml
|
||||
cat ${paperYaml} > paper.yml
|
||||
# Update the plugins
|
||||
mkdir -p plugins
|
||||
rm -rf plugins/*.jar
|
||||
${builtins.toString plugins}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "minecraft";
|
||||
|
|
|
@ -25,18 +25,7 @@ let
|
|||
# Adds a gradle step that downloads all the dependencies to the gradle cache.
|
||||
addResolveStep = ''
|
||||
git tag v5.4 # thanks build script
|
||||
${gnused}/bin/sed -i "s#'bukkit-legacy',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'bukkit-legacy:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'bungee',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'bungee:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'fabric',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'nukkit',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'nukkit:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge:sponge-service',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge:sponge-service-api8',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'velocity'##" settings.gradle
|
||||
cat >>build.gradle <<HERE
|
||||
task resolveDependencies {
|
||||
doLast {
|
||||
|
@ -78,7 +67,7 @@ let
|
|||
'';
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-2yX2YI6eT4MGxWYhsqKcDDrHuw/UFolU3lAZ1BWtTXc=";
|
||||
outputHash = "sha256-p+qnXBSJIZWVA8NJsKCZhdZhATD4MC/BU4TZMPSRUJo=";
|
||||
};
|
||||
|
||||
in
|
||||
|
@ -92,6 +81,17 @@ stdenv.mkDerivation {
|
|||
postPatch = addResolveStep;
|
||||
|
||||
buildPhase = ''
|
||||
${gnused}/bin/sed -i "s#'bukkit-legacy',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'bukkit-legacy:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'bungee',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'bungee:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'nukkit',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'nukkit:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge:loader',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge:sponge-service',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'sponge:sponge-service-api8',##" settings.gradle
|
||||
${gnused}/bin/sed -i "s#'velocity'##" settings.gradle
|
||||
export GRADLE_USER_HOME=$(${coreutils}/bin/mktemp -d)
|
||||
|
||||
# add local maven repo
|
||||
|
|
Loading…
Reference in a new issue