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

weechat: add NixOS module #33523

Closed

Conversation

lukateras
Copy link
Member

@lukateras lukateras commented Jan 6, 2018

Motivation for this change

Mainly for use with Glowing Bear or any other Weechat frontends, i.e. as an IRC relay/bouncer.

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
    • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

users.weechat = {
createHome = true;
group = "weechat";
home = cfg.root;
Copy link
Member

Choose a reason for hiding this comment

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

the indention seems off here

Copy link
Member Author

Choose a reason for hiding this comment

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

I should configure my Emacs to not do that. Thanks.

systemd.paths.weechat-fifo = {
pathConfig = {
PathExists = "${cfg.root}/weechat_fifo";
Unit = "weechat-apply-init.service";
Copy link
Member

Choose a reason for hiding this comment

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

the indention seems off here

serviceConfig = {
Type = "oneshot";
User = "weechat";
Group = "weechat";
Copy link
Member

Choose a reason for hiding this comment

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

the indention seems off here

};

config = mkIf cfg.enable {
users = {
Copy link
Member

Choose a reason for hiding this comment

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

I commonly come across shell-hosts that offer a bunch of weechat sessions (usually one per person, user, …).

Would you think it could make sense to refactor this to allow multiple weechat sessions per host?

Copy link
Member Author

@lukateras lukateras Jan 6, 2018

Choose a reason for hiding this comment

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

There are quite a few NixOS services that could benefit from running multiple copies. Tor, for example, is one of them, if someone is running an exit node and has multiple IPv4 addresses, it would make sense to run one instance of Tor per IPv4 address.

I think this should be implemented through containers rather than by adding complexity to each service that might benefit from this.

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Probably a sensible thing to do then 👍

User = "weechat";
Group = "weechat";
};
script = "exec ${pkgs.screen}/bin/screen -D -m ${pkgs.weechat}/bin/weechat";
Copy link
Member

Choose a reason for hiding this comment

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

The use of screen is probably opinionated as is the usage of tmux. I personally prefer tmux.

Do you think adding an option (defaulted to screen) would be sensible?

Copy link
Member Author

@lukateras lukateras Jan 6, 2018

Choose a reason for hiding this comment

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

tmux doesn't work here. Also, I'm not happy about this workaround, and I don't think that it should be a part of public API.

Copy link
Member

Choose a reason for hiding this comment

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

I think screen is fine for now given the use case for this module. Not sure if you can attach to a running screen or tmux session without some hackery anyway. ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, Weechat should be patched so that this hack is not required. It would be enough to strip ncurses initialization and run weechat without printing anything to terminal.

Choose a reason for hiding this comment

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

Weechat 2.1 has a headless mode.

@lukateras lukateras force-pushed the 20180106.130747/nixos-weechat branch 2 times, most recently from a38273c to c549fd4 Compare January 7, 2018 00:05
@lukateras lukateras force-pushed the 20180106.130747/nixos-weechat branch from c549fd4 to ab2f4eb Compare January 7, 2018 13:53
@Ma27
Copy link
Member

Ma27 commented Feb 10, 2018

this looks cool, what keeps us from merging ATM (and is there anything I could do?)

@andir
Copy link
Member

andir commented Feb 10, 2018

@Ma27 I probably have stalled it with my discussion. Sorry for that.

@yegortimoshenko Can you rebase this and merge?

@jtojnar
Copy link
Contributor

jtojnar commented Feb 22, 2018

It would be also nice if we had ACME support but it will be ugly without weechat/weechat#757

@fpletz fpletz added this to the 18.03 milestone Feb 23, 2018
@fpletz
Copy link
Member

fpletz commented Feb 23, 2018

@jtojnar Using nginx as proxy with the websocket support works pretty well for me. Even the Android app supports that. :)

@fpletz
Copy link
Member

fpletz commented Mar 12, 2018

I think the static uid/gid is not strictly needed, right? This would also resolve the merge conflict that's currently prevents merging this. :)

@Ma27
Copy link
Member

Ma27 commented Aug 27, 2018

@fpletz except the removal of the static uid/gid there's nothing else to change, right?
If that's the case I'd fix the PR as I'd really love to see this in 18.09! :)

@symphorien
Copy link
Member

If I understand the policy about static uids ( 8c3503d ) then weechat qualifies.

@Ma27 Ma27 mentioned this pull request Aug 29, 2018
9 tasks
@matthewbauer matthewbauer modified the milestones: 18.03, 18.09 Oct 1, 2018
@samueldr
Copy link
Member

samueldr commented Oct 6, 2018

#45728 is merged, and was started with "Follow-up for #33523", and seeing merge conflicts.

If there's nothing to be done here, that it's been fully implemented by #45728, could you close the PR? Otherwise, maybe describe what's left to do?

Thanks!

@samueldr samueldr removed this from the 18.09 milestone Oct 6, 2018
@Ma27
Copy link
Member

Ma27 commented Oct 6, 2018

this can be closed IMHO, the actual idea of adding a service which runs weechat in a screen has been implemented and merged to master.
The init script feature this PR provides is implemented on a package-level now, so non-NixOS user profit from that as well.

@samueldr
Copy link
Member

samueldr commented Oct 6, 2018

Closing; obviously if I'm wrong, just re-open :).

@samueldr samueldr closed this Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants