Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minecraft-server: add declarative setting for ops.json #92711

Closed
wants to merge 0 commits into from

Conversation

LEXUGE
Copy link
Contributor

@LEXUGE LEXUGE commented Jul 8, 2020

Motivation for this change

ops.json is used to manage server operators in Minecraft. Why don't we manage it declaratively!

Things done

Manage ops.json declaratively; apply nixfmt (I think the formatting is generally fine here).

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@LEXUGE
Copy link
Contributor Author

LEXUGE commented Jul 14, 2020

Any update here?

@infinisil
Copy link
Member

Hm is this backwards compatible? Because before this PR people would use /op commands to imperatively write ops.json, even if declarative = true. But with this PR it would not use the previous ops.json anymore.

@LEXUGE
Copy link
Contributor Author

LEXUGE commented Jul 14, 2020

Current .declarative design seems to block backward compatibility as any future components being "declarativized" is gonna to forcefully override it. Moreover, it yields file permission error because of the existence of .devlarative will not chmod +w the newly added file.
Also, if any part of the declarative files which need write permission got accidentally deleted, it would not work even after rebuild, since chmod will not be executed. This means there is a flaw in current design itself as well.
I think we should come up with a better mechanism for declarative file components management to both address backward compatibility and robustness.

@infinisil
Copy link
Member

Yeah that would be nice. One thought I've had for a while is to be able to toggle options between being static and dynamic. The static implementation of it would be declarative using the NixOS config (which is declarative, but also slow to change), and the dynamic implementation would allow runtime configuration. Changing an option between static and dynamic is still a bit hard though.

@LEXUGE
Copy link
Contributor Author

LEXUGE commented Aug 18, 2020

Yeah that would be nice. One thought I've had for a while is to be able to toggle options between being static and dynamic. The static implementation of it would be declarative using the NixOS config (which is declarative, but also slow to change), and the dynamic implementation would allow runtime configuration. Changing an option between static and dynamic is still a bit hard though.

Wouldn't that be the same as having a declarative option?
Painless converting seems to be hard, but I think user themselves should be responsible for their data.

@infinisil
Copy link
Member

infinisil commented Aug 18, 2020

Wouldn't that be the same as having a declarative option?

It would be a declarative option for every option separately. So you could e.g. do something like

{
  services.minecraft = {
    whitelist.declarative = true;
    whitelist.value = [ ... ];
    ops.declarative = false;
    # ops is taken from /var/lib/minecraft/ops.json
  };
}

And that without having to declare all the declarative options manually (so it would be a builtin module system feature)

description = "Level of the OP permissions of the OP user.";
};
};
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ops.json also features a "bypassesPlayerLimit": bool option that I suggest adding here (defaulting to false).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Busying now, probably would apply the change a few days later.

@Avaq
Copy link
Member

Avaq commented Jan 30, 2021

A competing PR has been opened a few months ago: #107308

@infinisil
Copy link
Member

Okay how about this: Only when declarative == true and ops != {}, the ops.json file is overridden. This should be backwards compatible.

@Avaq
Copy link
Member

Avaq commented Jan 31, 2021

That sounds good to me @infinisil. I would like the same to be true for other options. Personally I would use immutable ops and properties, but a mutable whitelist managed in-game by the ops.

@stale
Copy link

stale bot commented Jul 30, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 30, 2021
@LEXUGE LEXUGE closed this Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants