summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-04-06 18:03:18 +0200
committertv <tv@shackspace.de>2015-05-19 23:15:56 +0200
commit5e264d7ec671782daf8ce2c6c2f196794bd5848b (patch)
tree8b4665b6b7087917f3826915d548454cd969468d /modules
parenteb4c0b21e884a70c8413ede036b34483ad676cc9 (diff)
add urxvtd service module
Diffstat (limited to 'modules')
-rw-r--r--modules/urxvtd.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/urxvtd.nix b/modules/urxvtd.nix
new file mode 100644
index 000000000..ca21c6213
--- /dev/null
+++ b/modules/urxvtd.nix
@@ -0,0 +1,48 @@
+{ config, lib, pkgs, ... }:
+
+with builtins;
+with lib;
+
+{
+ options = {
+ services.urxvtd = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Enable urxvtd per user";
+ };
+ users = mkOption {
+ type = types.listOf types.string;
+ default = [];
+ description = "users to run urxvtd for";
+ };
+ urxvtPackage = mkOption {
+ type = types.package;
+ default = pkgs.rxvt_unicode;
+ description = "urxvt package to use";
+ };
+ };
+ };
+
+ config =
+ let
+ cfg = config.services.urxvtd;
+ users = cfg.users;
+ urxvt = cfg.urxvtPackage;
+ mkService = user: {
+ description = "urxvt terminal daemon";
+ wantedBy = [ "multi-user.target" ];
+ restartIfChanged = false;
+ serviceConfig = {
+ Restart = "always";
+ User = user;
+ Environment = "URXVT_PERL_LIB=${urxvt}/lib/urxvt/perl";
+ ExecStart = "${urxvt}/bin/urxvtd";
+ };
+ };
+ in
+ mkIf cfg.enable {
+ environment.systemPackages = [ urxvt ];
+ systemd.services = listToAttrs (map (u: { name = "${u}-urxvtd"; value = mkService u; }) users);
+ };
+}