Skip to content

Charybdis: Read MOTD files from /etc/charybdis. Add option to configure MOTD. #25512

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

Merged
merged 1 commit into from
May 25, 2017

Conversation

sh01
Copy link
Contributor

@sh01 sh01 commented May 4, 2017

Motivation for this change

The current charybdis build hardcodes the path to the MOTD file to the default file produced by the install in the nix store.
Charybdis doesn't have any option to override this path via cmdline flags or ircd.conf entries; this makes it exceedingly hard to configure.
We point this path at /etc/charybdis/ircd.motd instead and add a config option to write this file, for convenient configurability.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@mention-bot
Copy link

@sh01, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Lassulus, @fpletz and @4z3 to be potential reviewers.

@@ -51,46 +51,55 @@ in
'';
};

motd = mkOption {
type = types.nullOr types.string;
Copy link
Contributor

Choose a reason for hiding this comment

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

types.string is deprecated, is using it intentional? Usually, types.str or types.lines are better choices, depending on what kind of merge semantics you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not intentional, I just copied it from the extant option defs (not being aware of the deprecation; thanks!). "lines" sounds reasonable to me; I've changed it accordingly.

@sh01 sh01 force-pushed the charybdis_motdconf branch from 298a506 to d5f6dfb Compare May 9, 2017 21:49
@fpletz fpletz self-assigned this May 10, 2017
motd = mkOption {
type = types.nullOr types.lines;
default = null;
description = "Charybdis MOTD.";
Copy link
Member

Choose a reason for hiding this comment

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

As we're not managing any of the settings in the charybdis-config, we should inform the user here where the motd will be placed so that we can put it in this config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've expanded the description to include the path to the MOTD file we're using.
This isn't really useful for use in ircd.conf, since charybdis doesn't allow MOTD location to be configured there, but is still good to include for users who'd rather write the file themselves rather than letting nix manage it.

BANDB_DBPATH = "${cfg.statedir}/ban.db";
};
serviceConfig = {
ExecStart = "${charybdis}/bin/charybdis-ircd -foreground -logfile /dev/stdout -configfile ${configFile}";
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking about adding service reload support on changes to the configuration file at some point which is similar to the problem you're trying to solve. For instance the prosody service is also doing this. This behavior makes a lot of sense for such services that are best used with long-running connections and service uptime.

I'm not sure though if charybdis supports config reloading by sending signals. One can at least manually reload the config via IRC commands as an oper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't really seem to be documented, but diving into the source shows that yes, charybdis supports this - to be precise, it will reload (only) ircd.conf on SIGHUP, (only) MOTD on SIGUSR1 and (only) ban files on SIGUSR2. Splitting it up like this seems kinda silly to me, but there it is.
I don't know how one would set up sending of those signals in the nix config for the service, though to do it for other files than MOTD would require also symlinking those to somewhere they can be changed (probably /etc/charybdis, next to the motd).

Copy link
Member

Choose a reason for hiding this comment

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

Oh, thanks for looking into this. Anyway, I'll try that if I get around eventually. This pulll request looks good for now so let's merge this. :)

Verified

This commit was signed with the committer’s verified signature.
codetheweb Max Isom
…re MOTD.
@sh01 sh01 force-pushed the charybdis_motdconf branch from d5f6dfb to eea751b Compare May 10, 2017 20:51
BANDB_DBPATH = "${cfg.statedir}/ban.db";
};
serviceConfig = {
ExecStart = "${charybdis}/bin/charybdis-ircd -foreground -logfile /dev/stdout -configfile ${configFile}";
Copy link
Member

Choose a reason for hiding this comment

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

Oh, thanks for looking into this. Anyway, I'll try that if I get around eventually. This pulll request looks good for now so let's merge this. :)

@fpletz fpletz merged commit b3b2431 into NixOS:master May 25, 2017
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.

None yet

4 participants