diff options
author | gnidorah <gnidorah@users.noreply.github.com> | 2019-10-13 08:55:36 +0300 |
---|---|---|
committer | gnidorah <gnidorah@users.noreply.github.com> | 2020-02-21 18:57:56 +0300 |
commit | 1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be (patch) | |
tree | 76c4f6104acd9a55315529d9ac4a7ad844d6a9b4 /nixos/modules/config/qt5.nix | |
parent | 379c3f685c925f57dc38805a602a96d2f35db130 (diff) | |
download | nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.tar nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.tar.gz nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.tar.bz2 nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.tar.lz nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.tar.xz nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.tar.zst nixlib-1bd7ea84ad7e2bb4643ecf0f62e376aeb05ad7be.zip |
nixos/qt5: rename to qt
Diffstat (limited to 'nixos/modules/config/qt5.nix')
-rw-r--r-- | nixos/modules/config/qt5.nix | 232 |
1 files changed, 0 insertions, 232 deletions
diff --git a/nixos/modules/config/qt5.nix b/nixos/modules/config/qt5.nix deleted file mode 100644 index fb3e03c4b3fe..000000000000 --- a/nixos/modules/config/qt5.nix +++ /dev/null @@ -1,232 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.qt5; - - toQtIni = generators.toINI { - mkKeyValue = key: value: - let - value' = - if isBool value then (if value then "true" else "false") - else toString value; - in - "${key}=${value'}"; - }; - - general = - optionalAttrs (cfg.font != null) - { - font = cfg.font.name; - menuFont = cfg.font.name; - toolBarFont = cfg.font.name; - } - // - optionalAttrs (cfg.style != null) - { widgetStyle = cfg.style.name; }; - icons = - optionalAttrs (cfg.iconTheme != null) - { Theme = cfg.iconTheme.name; }; - - fontType = types.submodule { - options = { - package = mkOption { - internal = true; - type = types.nullOr types.package; - default = null; - }; - name = mkOption { - internal = true; - type = types.str; - }; - }; - }; - themeType = types.submodule { - options = { - package = mkOption { - internal = true; - type = types.nullOr types.package; - default = null; - }; - name = mkOption { - internal = true; - type = types.str; - }; - }; - }; - - optionalPackage = opt: - optional (opt != null && opt.package != null) opt.package; - - platforms = { - gtk2 = rec { - description = '' - <varlistentry> - <term><literal>gtk2</literal></term> - <listitem><para>Use GTK2 theme with - <link xlink:href="https://github.com/qt/qtstyleplugins">qtstyleplugins</link> - </para></listitem> - </varlistentry> - ''; - styles = [ "cleanlooks" "gtk2" "cde" "motif" "plastique" ]; - - assertions = [ - { - assertion = cfg.style != null && any (name: name == cfg.style.name) styles; - message = "`qt5.style.name` is not one of [ ${toString styles} ]."; - } - { - assertion = cfg.font == null && cfg.iconTheme == null; - message = "`qt5.font` and `qt5.iconTheme` are only supported by kde platform."; - } - ]; - environment.variables.QT_QPA_PLATFORMTHEME = "gtk2"; - environment.variables.QT_STYLE_OVERRIDE = cfg.style.name; - environment.systemPackages = [ pkgs.libsForQt5.qtstyleplugins ]; - }; - qgnomeplatform = { - description = '' - <varlistentry> - <term><literal>qgnomeplatform</literal></term> - <listitem><para>Use GNOME theme with - <link xlink:href="https://github.com/FedoraQt/QGnomePlatform">qgnomeplatform</link> - </para></listitem> - </varlistentry> - ''; - - assertions = [ - { - assertion = cfg.font == null && cfg.iconTheme == null; - message = "`qt5.font` and `qt5.iconTheme` are only supported by kde platform."; - } - ]; - environment.variables.QT_QPA_PLATFORMTHEME = "qgnomeplatform"; - # TODO: make this optional once https://github.com/NixOS/nixpkgs/issues/54150 is fixed - # qgnomeplatform reads theme and other settings from dconf db - environment.variables.QT_STYLE_OVERRIDE = cfg.style.name; - environment.variables.XDG_DATA_DIRS = [ "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}" ]; - environment.systemPackages = [ pkgs.qgnomeplatform ]; - }; - gtk3 = { - description = '' - <varlistentry> - <term><literal>gtk3</literal></term> - <listitem><para>Use GNOME theme with - <link xlink:href="https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platformthemes/gtk3">gtk3</link> - </para></listitem> - </varlistentry> - ''; - - assertions = [ - { - assertion = cfg.style != null; - message = "`qt5.platformTheme` gtk3 requires `qt5.style` to be set."; - } - { - assertion = cfg.font == null && cfg.iconTheme == null; - message = "`qt5.font` and `qt5.iconTheme` are only supported by kde platform."; - } - ]; - environment.variables.QT_QPA_PLATFORMTHEME = "gtk3"; - environment.variables.QT_STYLE_OVERRIDE = cfg.style.name; - }; - kde = { - description = '' - <varlistentry> - <term><literal>kde</literal></term> - <listitem><para>Use Qt theme with - <link xlink:href="https://code.qt.io/cgit/qt/qtbase.git/tree/src/platformsupport/themes/genericunix">qkdetheme</link> - </para></listitem> - </varlistentry> - ''; - - environment.variables.XDG_CURRENT_DESKTOP = mkForce "KDE"; - environment.variables.KDE_SESSION_VERSION = "5"; - environment.etc."xdg/kdeglobals".text = - toQtIni { - General = general; - Icons = icons; - }; - }; - }; -in - -{ - - options = { - qt5 = { - - enable = mkEnableOption "Qt5 theming configuration"; - - platformTheme = mkOption { - type = types.enum (attrNames platforms); - example = head (attrNames platforms); - description = '' - Selects the platform theme to use for Qt5 applications.</para> - <para>The options are - <variablelist> - ${concatStrings (mapAttrsToList (name: value: value.description) platforms)} - </variablelist> - ''; - }; - - font = mkOption { - type = types.nullOr fontType; - default = null; - example = literalExample '' - { - name = "Noto Sans,10,-1,5,50,0,0,0,0,0,Regular"; - package = pkgs.noto-fonts; - } - ''; - description = '' - The font to use in Qt applications. - ''; - }; - - iconTheme = mkOption { - type = types.nullOr themeType; - default = null; - example = literalExample '' - { - name = "breeze"; - package = pkgs.breeze-icons; - } - ''; - description = "The icon theme to use."; - }; - - style = mkOption { - type = types.nullOr themeType; - default = null; - example = literalExample '' - { - name = "Breeze"; - package = pkgs.breeze-qt5; - }; - ''; - description = "The Qt style to use."; - }; - - }; - }; - - config = mkIf cfg.enable { - - assertions = attrByPath [ cfg.platformTheme "assertions" ] [] platforms; - - environment.variables = attrByPath [ cfg.platformTheme "environment" "variables" ] {} platforms; - - environment.etc = attrByPath [ cfg.platformTheme "environment" "etc" ] {} platforms; - - environment.systemPackages = attrByPath [ cfg.platformTheme "environment" "systemPackages" ] [] platforms - ++ optionalPackage cfg.font - ++ optionalPackage cfg.style - ++ optionalPackage cfg.iconTheme; - - }; - - meta.maintainers = with maintainers; [ worldofpeace gnidorah ]; -} |