mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
qt: remove top-level with lib
This commit is contained in:
parent
5744ebf359
commit
4b2d3b03be
1 changed files with 18 additions and 18 deletions
|
@ -1,9 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.qt;
|
cfg = config.qt;
|
||||||
|
|
||||||
# Maps known lowercase style names to style packages. Non-exhaustive.
|
# Maps known lowercase style names to style packages. Non-exhaustive.
|
||||||
|
@ -28,20 +25,23 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with maintainers; [ rycee thiagokokada ];
|
meta.maintainers = with lib.maintainers; [ rycee thiagokokada ];
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkChangedOptionModule [ "qt" "useGtkTheme" ] [ "qt" "platformTheme" ]
|
(lib.mkChangedOptionModule [ "qt" "useGtkTheme" ] [ "qt" "platformTheme" ]
|
||||||
(config:
|
(config:
|
||||||
if getAttrFromPath [ "qt" "useGtkTheme" ] config then "gtk" else null))
|
if lib.getAttrFromPath [ "qt" "useGtkTheme" ] config then
|
||||||
|
"gtk"
|
||||||
|
else
|
||||||
|
null))
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
qt = {
|
qt = {
|
||||||
enable = mkEnableOption "Qt 5 and 6 configuration";
|
enable = lib.mkEnableOption "Qt 5 and 6 configuration";
|
||||||
|
|
||||||
platformTheme = mkOption {
|
platformTheme = lib.mkOption {
|
||||||
type = types.nullOr (types.enum [ "gtk" "gnome" "qtct" "kde" ]);
|
type = with lib.types; nullOr (enum [ "gtk" "gnome" "qtct" "kde" ]);
|
||||||
default = null;
|
default = null;
|
||||||
example = "gnome";
|
example = "gnome";
|
||||||
relatedPackages = [
|
relatedPackages = [
|
||||||
|
@ -77,8 +77,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
style = {
|
style = {
|
||||||
name = mkOption {
|
name = lib.mkOption {
|
||||||
type = types.nullOr types.str;
|
type = with lib.types; nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
example = "adwaita-dark";
|
example = "adwaita-dark";
|
||||||
relatedPackages = [
|
relatedPackages = [
|
||||||
|
@ -111,10 +111,10 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = lib.mkOption {
|
||||||
type = with types; nullOr (either package (listOf package));
|
type = with lib.types; nullOr (either package (listOf package));
|
||||||
default = null;
|
default = null;
|
||||||
example = literalExpression "pkgs.adwaita-qt";
|
example = lib.literalExpression "pkgs.adwaita-qt";
|
||||||
description = ''
|
description = ''
|
||||||
Theme package to be used in Qt5/Qt6 applications.
|
Theme package to be used in Qt5/Qt6 applications.
|
||||||
Auto-detected from {option}`qt.style.name` if possible.
|
Auto-detected from {option}`qt.style.name` if possible.
|
||||||
|
@ -130,7 +130,7 @@ in {
|
||||||
envVars = let
|
envVars = let
|
||||||
inherit (config.home) profileDirectory;
|
inherit (config.home) profileDirectory;
|
||||||
qtVersions = with pkgs; [ qt5 qt6 ];
|
qtVersions = with pkgs; [ qt5 qt6 ];
|
||||||
in filterAttrs (n: v: v != null) {
|
in lib.filterAttrs (n: v: v != null) {
|
||||||
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
|
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
|
||||||
"gtk2"
|
"gtk2"
|
||||||
else if cfg.platformTheme == "qtct" then
|
else if cfg.platformTheme == "qtct" then
|
||||||
|
@ -148,7 +148,7 @@ in {
|
||||||
qtVersions));
|
qtVersions));
|
||||||
};
|
};
|
||||||
|
|
||||||
in mkIf (cfg.enable && cfg.platformTheme != null) {
|
in lib.mkIf (cfg.enable && cfg.platformTheme != null) {
|
||||||
assertions = [{
|
assertions = [{
|
||||||
assertion = cfg.platformTheme == "gnome" -> cfg.style.name != null
|
assertion = cfg.platformTheme == "gnome" -> cfg.style.name != null
|
||||||
&& cfg.style.package != null;
|
&& cfg.style.package != null;
|
||||||
|
@ -158,8 +158,8 @@ in {
|
||||||
'';
|
'';
|
||||||
}];
|
}];
|
||||||
|
|
||||||
qt.style.package = mkIf (cfg.style.name != null)
|
qt.style.package = lib.mkIf (cfg.style.name != null)
|
||||||
(mkDefault (stylePackages.${toLower cfg.style.name} or null));
|
(lib.mkDefault (stylePackages.${lib.toLower cfg.style.name} or null));
|
||||||
|
|
||||||
home.sessionVariables = envVars;
|
home.sessionVariables = envVars;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue