Skip to content

Instantly share code, notes, and snippets.

@tilpner
Created January 1, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tilpner/3da009df9bd66dd0aff6a662f5dcb432 to your computer and use it in GitHub Desktop.
Save tilpner/3da009df9bd66dd0aff6a662f5dcb432 to your computer and use it in GitHub Desktop.
{ config, pkgs, mod, ... }:
let
inherit (pkgs) abduco weechat;
in {
users.users.weechat = {
isSystemUser = true;
home = "/var/lib/weechat";
createHome = true;
openssh.authorizedKeys.keyFiles = [
(mod /assets/somehostname.pub)
];
packages = [ abduco ];
files.".profile".text = ''
if [ -n "$SSH_TTY" ]; then
exec abduco -a irc
fi
'';
shell = pkgs.bashInteractive;
};
services.nginx.virtualHosts."weechat.my.domain" = {
forceSSL = true;
enableACME = true;
locations."/weechat" = {
proxyPass = "http://127.0.0.1:9000/weechat";
extraConfig = ''
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
'';
};
};
systemd.services.weechat = {
path = with pkgs; [ abduco weechat ];
script = ''
abduco -n irc weechat -d ${config.users.users.weechat.home}
'';
environment = {
TERM = "st-256color";
NCURSES_NO_UTF8_ACS = "1";
};
serviceConfig = {
Type = "forking";
User = "weechat";
WorkingDirectory = config.users.users.weechat.home;
Restart = "always";
RestartSec = 3;
};
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment