diff options
author | lassulus <lass@aidsballs.de> | 2015-07-16 15:49:45 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-07-16 15:49:45 +0200 |
commit | b6a03c53ea36b8c9544cf8e53c4f2dc373065b36 (patch) | |
tree | 8712bf5e30352026ec05596f1b6f1fb2242f1f97 /3modules/lass | |
parent | fa45f544b38bacd4868b5c92f0ca02ab343bb115 (diff) |
3 lass.urxvtd: init
Diffstat (limited to '3modules/lass')
-rw-r--r-- | 3modules/lass/urxvtd.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/3modules/lass/urxvtd.nix b/3modules/lass/urxvtd.nix new file mode 100644 index 0000000..469616a --- /dev/null +++ b/3modules/lass/urxvtd.nix @@ -0,0 +1,55 @@ +{ config, lib, pkgs, ... }: + +let +in + +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; + path = [ pkgs.xlibs.xrdb ]; + environment = { + DISPLAY = ":0"; + URXVT_PERL_LIB = "${urxvt}/lib/urxvt/perl"; + }; + serviceConfig = { + Restart = "always"; + User = user; + ExecStart = "${urxvt}/bin/urxvtd"; + }; + }; + in + mkIf cfg.enable { + environment.systemPackages = [ urxvt ]; + systemd.services = listToAttrs (map (u: { name = "${u}-urxvtd"; value = mkService u; }) users); + }; +} |