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

Add public, logFile and preset flags #14

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

muItilingualism
Copy link
Contributor

New options:

-public 1
-logFile /var/lib/valheim/log/valheim-server.log
-preset "hardcore"

By default the public flag is set to true as per the docs.

I think the preset flag is "normal" by default, but leaving it out if the user does not specify it is a better idea imo.

Defaults to true when not set. This is apparently the default: 
"public 1 - Set the visibility of your server. 1 is default and will make the server visible in the browser.
Set it to 0 to make the server invisible and only joinable via the ‘Join IP’-button."
source: https://www.valheimgame.com/support/a-guide-to-dedicated-servers/
@muItilingualism
Copy link
Contributor Author

Maybe it is possible to create an enum for the -preset flag for all possible options?

@aidalgol
Copy link
Owner

aidalgol commented Aug 4, 2024

Maybe it is possible to create an enum for the -preset flag for all possible options?

You certainly could.

I'm not sure about the log-file option. Is there a good reason to not use journald?

@muItilingualism
Copy link
Contributor Author

I'm not sure about the log-file option. Is there a good reason to not use journald?

I think that since the option is available for a regular valheim dedicated server that it could also be available here.

Not sure if it is possible to redirect logs to another file without the -logFile flag.

Comment on lines +75 to +89
logFile = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
example = "/var/lib/valheim/log/valheim-server.log";
description = lib.mdDoc ''
The path where the server log file will be saved.

When set, this will redirect all logs from stdout to the specified path.
This means that the logs will not be captured by systemd's journal.
Leave this option unset to keep console logging enabled.

Make sure the valheim user has write access to the specified directory, otherwise
the valheim service fail to start and exit.
'';
};
Copy link
Owner

Choose a reason for hiding this comment

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

I think -logFile is there because upstream expects you to run it using their wrapper script, from the commandline, where the log output will just go to your terminal scrollback buffer. The NixOS module provided by this flake instead runs it using systemd. Telling the underlying program to log to a file instead of standard out/error somewhat goes against the purpose of running as a systemd service, so I would rather not expose that function.

Comment on lines +91 to +99
preset = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
example = "hardcore";
description = lib.mdDoc ''
The preset world modifier, valid options are
"easy", "hard", "hardcore", "casual", "hammer" and "immersive".
'';
};
Copy link
Owner

Choose a reason for hiding this comment

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

Regarding your comment about using an enum type, you would change the type from nullOr str to nullOr (enum ["easy" "hard" ...]) (replacing ... with the rest of the enum values), and then remove the list of values from the description.

Reference: NixOS Manual

hamburger1984 added a commit to hamburger1984/valheim-server-flake that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants