nixpkgs/nixos/modules/services/x11/window-managers/herbstluftwm.nix
h7x4 0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00

41 lines
1.0 KiB
Nix

{ 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 ];
};
}