about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/x11/window-managers/herbstluftwm.nix
blob: 16ebc2bfe1d301046e85c596bcbabbc381563825 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.xserver.windowManager.herbstluftwm;
in

{
  options = {
    services.xserver.windowManager.herbstluftwm = {
      enable = mkEnableOption (lib.mdDoc "herbstluftwm");

      package = mkPackageOption pkgs "herbstluftwm" { };

      configFile = mkOption {
        default     = null;
        type        = with types; nullOr path;
        description = lib.mdDoc ''
          Path to the herbstluftwm configuration file.  If left at the
          default value, $XDG_CONFIG_HOME/herbstluftwm/autostart will
          be used.
        '';
      };
    };
  };

  config = mkIf cfg.enable {
    services.xserver.windowManager.session = singleton {
      name = "herbstluftwm";
      start =
        let configFileClause = optionalString
            (cfg.configFile != null)
            ''-c "${cfg.configFile}"''
            ;
        in "${cfg.package}/bin/herbstluftwm ${configFileClause} &";
    };
    environment.systemPackages = [ cfg.package ];
  };
}