qtile: add more options and expose unwrapped package
This commit is contained in:
parent
edc62383e4
commit
1addf91b0b
5 changed files with 124 additions and 85 deletions
|
@ -1,23 +1,63 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.xserver.windowManager.qtile;
|
||||
pyEnv = pkgs.python3.withPackages (p: [ (cfg.package.unwrapped or cfg.package) ] ++ (cfg.extraPackages p));
|
||||
in
|
||||
|
||||
{
|
||||
options.services.xserver.windowManager.qtile = {
|
||||
enable = mkEnableOption (lib.mdDoc "qtile");
|
||||
|
||||
package = mkPackageOptionMD pkgs "qtile" { };
|
||||
package = mkPackageOptionMD pkgs "qtile-unwrapped" { };
|
||||
|
||||
configFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
example = literalExpression "./your_config.py";
|
||||
description = lib.mdDoc ''
|
||||
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 = lib.mdDoc ''
|
||||
Backend to use in qtile:
|
||||
<option>x11</option> or <option>wayland</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = types.functionTo (types.listOf types.package);
|
||||
default = _: [];
|
||||
defaultText = literalExpression ''
|
||||
python3Packages: with python3Packages; [];
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Extra Python packages available to Qtile.
|
||||
An example would be to include `python3Packages.qtile-extras`
|
||||
for additional unoffical widgets.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
python3Packages: with python3Packages; [
|
||||
qtile-extras
|
||||
];
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.xserver.windowManager.session = [{
|
||||
name = "qtile";
|
||||
start = ''
|
||||
${cfg.package}/bin/qtile start &
|
||||
${pyEnv}/bin/qtile start -b ${cfg.backend} \
|
||||
${optionalString (cfg.configFile != null)
|
||||
"--config \"${cfg.configFile}\""} &
|
||||
waitPID=$!
|
||||
'';
|
||||
}];
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
, pulseaudio
|
||||
}:
|
||||
|
||||
let
|
||||
unwrapped = python3Packages.buildPythonPackage rec {
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "qtile";
|
||||
version = "0.22.1";
|
||||
|
||||
|
@ -85,14 +84,4 @@ let
|
|||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ kamilchm arjan-s ];
|
||||
};
|
||||
};
|
||||
in
|
||||
(python3.withPackages (_: [ unwrapped ])).overrideAttrs (_: {
|
||||
# otherwise will be exported as "env", this restores `nix search` behavior
|
||||
name = "${unwrapped.pname}-${unwrapped.version}";
|
||||
# export underlying qtile package
|
||||
passthru = { inherit unwrapped; };
|
||||
|
||||
# restore original qtile attrs
|
||||
inherit (unwrapped) pname version meta;
|
||||
})
|
||||
}
|
||||
|
|
9
pkgs/applications/window-managers/qtile/wrapper.nix
Normal file
9
pkgs/applications/window-managers/qtile/wrapper.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ python3, qtile-unwrapped }:
|
||||
(python3.withPackages (_: [ qtile-unwrapped ])).overrideAttrs (_: {
|
||||
# otherwise will be exported as "env", this restores `nix search` behavior
|
||||
name = "${qtile-unwrapped.pname}-${qtile-unwrapped.version}";
|
||||
# export underlying qtile package
|
||||
passthru = { unwrapped = qtile-unwrapped; };
|
||||
# restore original qtile attrs
|
||||
inherit (qtile-unwrapped) pname version meta;
|
||||
})
|
|
@ -6,7 +6,7 @@
|
|||
, xorgserver
|
||||
, pulseaudio
|
||||
, pytest-asyncio
|
||||
, qtile
|
||||
, qtile-unwrapped
|
||||
, keyring
|
||||
, requests
|
||||
, stravalib
|
||||
|
@ -34,7 +34,7 @@ buildPythonPackage rec {
|
|||
];
|
||||
checkInputs = [
|
||||
pytest-asyncio
|
||||
qtile.unwrapped
|
||||
qtile-unwrapped
|
||||
pulseaudio
|
||||
keyring
|
||||
requests
|
||||
|
|
|
@ -34077,7 +34077,8 @@ with pkgs;
|
|||
|
||||
qpdfview = libsForQt5.callPackage ../applications/office/qpdfview { };
|
||||
|
||||
qtile = callPackage ../applications/window-managers/qtile { };
|
||||
qtile-unwrapped = callPackage ../applications/window-managers/qtile { };
|
||||
qtile = callPackage ../applications/window-managers/qtile/wrapper.nix { };
|
||||
|
||||
vimgolf = callPackage ../games/vimgolf { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue