Created
August 1, 2017 02:19
-
-
Save kristoff3r/40385a96f123e12967a74af52b372819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.services.irssi; | |
irssi-config = pkgs.callPackage ../packages/irssi-config/default.nix {}; | |
irssi-user = "irssi"; | |
in | |
{ | |
###### interface | |
options.services.irssi = { | |
enable = mkEnableOption "Screen + Irssi session"; | |
}; | |
###### implementation | |
config = mkIf cfg.enable { | |
environment.systemPackages = with pkgs; [ screen irssi irssi_otr irssi-config perlPackages.LWPUserAgent ]; | |
systemd.services."irssi" = { | |
description = "Irssi and Screen session"; | |
after = [ "network.target" ]; | |
wantedBy = [ "multiuser.target" ]; | |
serviceConfig = { | |
#User = irssi-user; | |
#Group = irssi-user; | |
PermissionsStartOnly = true; | |
Type = "forking"; | |
ExecStart = "${pkgs.screen}/bin/screen -dmS irc ${pkgs.irssi}/bin/irssi --home ${irssi-config}"; | |
ExecStop = "${pkgs.screen}/bin/screen -S irc -X stuff 'quit\\n'"; | |
Restart = "on-failure"; | |
}; | |
}; | |
users = { | |
users."${irssi-user}" = { | |
name = irssi-user; | |
group = irssi-user; | |
home = "/home/${irssi-user}"; | |
createHome = true; | |
shell = pkgs.bashInteractive; | |
openssh.authorizedKeys.keys = with import ../misc/ssh-keys.nix; [ bubbles ]; | |
description = "User for running the irssi client"; | |
}; | |
groups."${irssi-user}" = { | |
name = irssi-user; | |
}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment