anchor.diff:        serviceConfig.Restart = "always";
         serviceConfig.User    = "minecraft";
         script = ''
  -        cd /var/lib/minecraft
  +        cd ${cfg.dataDir}
           exec ${pkgs.minecraft-server}/bin/minecraft-server ${cfg.jvmOpts}
         '';
       };
  +
  +    networking.firewall = mkIf cfg.openFirewall {
  +      allowedUDPPorts = [ 25565 ];
  +      allowedTCPPorts = [ 25565 ];
  +    };
     };
   }
  
positive.code: {
    options = {
      services.minecraft-server = {
        enable = mkOption {
          type = types.bool;
          default = false;
  
negative.code:   config = mkIf cfg.enable {
      users.extraUsers.minecraft = {
        description     = "Minecraft Server Service user";
        home            = cfg.dataDir;
        createHome      = true;
        uid             = config.ids.uids.minecraft;
      };
  