add per-user permissions
This commit is contained in:
parent
cae5c4fd3c
commit
3426f6d102
2 changed files with 61 additions and 2 deletions
|
@ -73,6 +73,16 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
users = {
|
||||
a6578f9a-288d-44af-8f43-e6402b126bb6 = {
|
||||
uuid = "a6578f9a-288d-44af-8f43-e6402b126bb6";
|
||||
name = "DarkKirb";
|
||||
groups = [
|
||||
"admin"
|
||||
"default"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
|
|
|
@ -6,16 +6,24 @@ let
|
|||
opt = options.services.minecraft.luckperms;
|
||||
luckperms-yml = pkgs.writeText "luckperms.yml" (generators.toYAML { } cfg.config);
|
||||
groups = builtins.mapAttrs (name: value: pkgs.writeText "${name}.yml" (generators.toYAML { } value)) cfg.groups;
|
||||
permCopy = builtins.map
|
||||
users = builtins.mapAttrs (name: value: pkgs.writeText "${name}.yml" (generators.toYAML { } value)) cfg.users;
|
||||
groupPermCopy = builtins.map
|
||||
(group: ''
|
||||
cat ${groups.${group}} > plugins/LuckPerms/yaml-storage/groups/${group}.yml
|
||||
'')
|
||||
(builtins.attrNames groups);
|
||||
userPermCopy = builtins.map
|
||||
(user: ''
|
||||
cat ${users.${user}} > plugins/LuckPerms/yaml-storage/users/${user}.yml
|
||||
'')
|
||||
(builtins.attrNames groups);
|
||||
startScript = pkgs.writeScript "luckperms" ''
|
||||
mkdir -p plugins/LuckPerms
|
||||
cat ${luckperms-yml} > plugins/LuckPerms/config.yml
|
||||
mkdir -p plugins/LuckPerms/yaml-storage/groups/
|
||||
${builtins.toString permCopy}
|
||||
${builtins.toString groupPermCopy}
|
||||
mkdir -p plugins/LuckPerms/yaml-storage/users/
|
||||
${builtins.toString userPermCopy}
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
@ -314,6 +322,10 @@ in
|
|||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
parents = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
permissions = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
|
@ -322,10 +334,47 @@ in
|
|||
default = [ ];
|
||||
type = types.listOf (types.attrsOf types.anything);
|
||||
};
|
||||
meta = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf types.anything;
|
||||
};
|
||||
};
|
||||
});
|
||||
description = "Group configuration";
|
||||
};
|
||||
users = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
uuid = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
primary-group = mkOption {
|
||||
type = types.str;
|
||||
default = "default";
|
||||
};
|
||||
parents = mkOption {
|
||||
default = [ "default" ];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
permissions = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
prefixes = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf (types.attrsOf types.anything);
|
||||
};
|
||||
meta = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf types.anything;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
services.minecraft.plugins = [{
|
||||
|
|
Loading…
Reference in a new issue