From b6da6569c4ff53cf0cabd5371b501069810febf3 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 17 May 2018 19:39:26 +0200 Subject: [PATCH] qt: add module --- modules/misc/news.nix | 10 ++++++++++ modules/misc/qt.nix | 39 +++++++++++++++++++++++++++++++++++++++ modules/modules.nix | 1 + 3 files changed, 50 insertions(+) create mode 100644 modules/misc/qt.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 99a7cb3e..1fa0277d 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -647,6 +647,16 @@ in A new module is available: 'services.flameshot'. ''; } + + { + time = "2018-05-18T18:34:15+00:00"; + message = '' + A new module is available: 'qt' + + At the moment this module allows you to set up Qt to use the + GTK+ theme, and not much else. + ''; + } ]; }; } diff --git a/modules/misc/qt.nix b/modules/misc/qt.nix new file mode 100644 index 00000000..ae697b25 --- /dev/null +++ b/modules/misc/qt.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.qt; + dag = config.lib.dag; + +in + +{ + meta.maintainers = [ maintainers.rycee ]; + + options = { + qt = { + enable = mkEnableOption "Qt 4 and 5 configuration"; + + useGtkTheme = mkOption { + type = types.bool; + default = false; + description = '' + Whether Qt 4 and 5 should be set up to use the GTK theme + settings. + ''; + }; + }; + }; + + config = mkIf (cfg.enable && cfg.useGtkTheme) { + home.sessionVariables.QT_QPA_PLATFORMTHEME = "gtk2"; + home.packages = [ pkgs.libsForQt5.qtstyleplugins ]; + + home.activation.useGtkThemeInQt4 = dag.entryAfter ["writeBoundary"] '' + $DRY_RUN_CMD ${pkgs.crudini}/bin/crudini $VERBOSE_ARG \ + --set $HOME/.config/Trolltech.conf Qt style GTK+ + ''; + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index b36ad4f4..b35a0e86 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -21,6 +21,7 @@ let ./misc/news.nix ./misc/nixpkgs.nix ./misc/pam.nix + ./misc/qt.nix ./misc/xdg.nix ./programs/autorandr.nix ./programs/bash.nix