nixpkgs/nixos/modules/services/x11/window-managers/qtile.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
2.0 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, ... }:
2015-07-30 05:31:53 +00:00
with lib;
let
cfg = config.services.xserver.windowManager.qtile;
pyEnv = pkgs.python3.withPackages (p: [ (cfg.package.unwrapped or cfg.package) ] ++ (cfg.extraPackages p));
2015-07-30 05:31:53 +00:00
in
{
2022-04-05 17:44:03 +00:00
options.services.xserver.windowManager.qtile = {
enable = mkEnableOption "qtile";
2022-04-05 17:44:03 +00:00
package = mkPackageOption pkgs "qtile-unwrapped" { };
configFile = mkOption {
type = with types; nullOr path;
default = null;
example = literalExpression "./your_config.py";
description = ''
Path to the qtile configuration file.
If null, $XDG_CONFIG_HOME/qtile/config.py will be used.
'';
};
backend = mkOption {
type = types.enum [ "x11" "wayland" ];
default = "x11";
description = ''
2023-03-31 23:21:31 +00:00
Backend to use in qtile: `x11` or `wayland`.
'';
};
extraPackages = mkOption {
type = types.functionTo (types.listOf types.package);
default = _: [];
defaultText = literalExpression ''
python3Packages: with python3Packages; [];
'';
description = ''
Extra Python packages available to Qtile.
An example would be to include `python3Packages.qtile-extras`
2023-05-20 02:11:38 +00:00
for additional unofficial widgets.
'';
example = literalExpression ''
python3Packages: with python3Packages; [
qtile-extras
];
'';
};
2015-07-30 05:31:53 +00:00
};
config = mkIf cfg.enable {
services.xserver.windowManager.session = [{
name = "qtile";
start = ''
${pyEnv}/bin/qtile start -b ${cfg.backend} \
${optionalString (cfg.configFile != null)
"--config \"${cfg.configFile}\""} &
2015-07-30 05:31:53 +00:00
waitPID=$!
'';
}];
environment.systemPackages = [
# pkgs.qtile is currently a buildenv of qtile and its dependencies.
# For userland commands, we want the underlying package so that
# packages such as python don't bleed into userland and overwrite intended behavior.
2022-04-05 17:44:03 +00:00
(cfg.package.unwrapped or cfg.package)
];
2015-07-30 05:31:53 +00:00
};
}