mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-12 20:11:06 +01:00
qt: added qt{5,6}ctSettings options (#8271)
Added qtctSettings option to qt module to make it possible to configure qt(5/6)ct declaratively.
This commit is contained in:
parent
082822b8a6
commit
f9d45d664e
5 changed files with 90 additions and 1 deletions
|
|
@ -8,6 +8,10 @@
|
||||||
let
|
let
|
||||||
cfg = config.qt;
|
cfg = config.qt;
|
||||||
|
|
||||||
|
qtctFormat = pkgs.formats.ini {
|
||||||
|
listToValue = values: lib.concatStringsSep ", " values;
|
||||||
|
};
|
||||||
|
|
||||||
# Map platform names to their packages.
|
# Map platform names to their packages.
|
||||||
platformPackages = with pkgs; {
|
platformPackages = with pkgs; {
|
||||||
gnome = [
|
gnome = [
|
||||||
|
|
@ -286,7 +290,34 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
// (lib.genAttrs' [ "qt5ct" "qt6ct" ] (
|
||||||
|
name:
|
||||||
|
lib.nameValuePair "${name}Settings" (
|
||||||
|
lib.mkOption {
|
||||||
|
type = lib.types.nullOr qtctFormat.type;
|
||||||
|
default = null;
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
Appearance = {
|
||||||
|
style = "kvantum";
|
||||||
|
icon_theme = "Papirus-Dark";
|
||||||
|
standar_dialogs = "xdgdesktopportal";
|
||||||
|
};
|
||||||
|
Fonts = {
|
||||||
|
fixed = "\"DejaVuSansM Nerd Font Mono,12\"";
|
||||||
|
general = "\"DejaVu Sans,12\"";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Qtct configuration. Writes settings to `${name}/${name}.conf`
|
||||||
|
file. Lists will be translated to comma-separated strings.
|
||||||
|
Fonts must be quoted (see example).
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
)
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
|
|
@ -397,5 +428,18 @@ in
|
||||||
]
|
]
|
||||||
++ lib.optionals (platformTheme.name != null) [ "QT_QPA_PLATFORMTHEME" ]
|
++ lib.optionals (platformTheme.name != null) [ "QT_QPA_PLATFORMTHEME" ]
|
||||||
++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ];
|
++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ];
|
||||||
|
|
||||||
|
xdg.configFile =
|
||||||
|
lib.pipe
|
||||||
|
[ "qt5ct" "qt6ct" ]
|
||||||
|
[
|
||||||
|
(lib.filter (qtct: cfg."${qtct}Settings" != null))
|
||||||
|
(lib.flip lib.genAttrs' (
|
||||||
|
qtct:
|
||||||
|
lib.nameValuePair "${qtct}/${qtct}.conf" {
|
||||||
|
source = qtctFormat.generate "${qtct}-config" cfg."${qtct}Settings";
|
||||||
|
}
|
||||||
|
))
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,7 @@
|
||||||
qt-platform-theme-gtk3 = ./qt-platform-theme-gtk3.nix;
|
qt-platform-theme-gtk3 = ./qt-platform-theme-gtk3.nix;
|
||||||
qt-platform-theme-gnome = ./qt-platform-theme-gnome.nix;
|
qt-platform-theme-gnome = ./qt-platform-theme-gnome.nix;
|
||||||
qt-platform-theme-kde6-migration = ./qt-platform-theme-kde6-migration.nix;
|
qt-platform-theme-kde6-migration = ./qt-platform-theme-kde6-migration.nix;
|
||||||
|
qt-qt5ct-settings = ./qt-qt5ct-settings.nix;
|
||||||
|
qt-qt6ct-settings = ./qt-qt6ct-settings.nix;
|
||||||
|
qt-qtct-settings = ./qt-qtct-settings.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
tests/modules/misc/qt/qt-qt5ct-settings.nix
Normal file
13
tests/modules/misc/qt/qt-qt5ct-settings.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
qt = {
|
||||||
|
enable = true;
|
||||||
|
qt5ctSettings = {
|
||||||
|
test_section.test_option = "test";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists "home-files/.config/qt5ct/qt5ct.conf"
|
||||||
|
assertPathNotExists "home-files/.config/qt6ct/qt6ct.conf"
|
||||||
|
'';
|
||||||
|
}
|
||||||
13
tests/modules/misc/qt/qt-qt6ct-settings.nix
Normal file
13
tests/modules/misc/qt/qt-qt6ct-settings.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
qt = {
|
||||||
|
enable = true;
|
||||||
|
qt6ctSettings = {
|
||||||
|
test_section.test_option = "test";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists "home-files/.config/qt6ct/qt6ct.conf"
|
||||||
|
assertPathNotExists "home-files/.config/qt5ct/qt5ct.conf"
|
||||||
|
'';
|
||||||
|
}
|
||||||
16
tests/modules/misc/qt/qt-qtct-settings.nix
Normal file
16
tests/modules/misc/qt/qt-qtct-settings.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
qt = {
|
||||||
|
enable = true;
|
||||||
|
qt5ctSettings = {
|
||||||
|
test_section.test_option = "test";
|
||||||
|
};
|
||||||
|
qt6ctSettings = {
|
||||||
|
test_section.test_option = "test";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists "home-files/.config/qt5ct/qt5ct.conf"
|
||||||
|
assertFileExists "home-files/.config/qt6ct/qt6ct.conf"
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue