-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.nix
78 lines (62 loc) · 2.28 KB
/
theme.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# inspired by https://github.com/bennofs/etc-nixos/blob/master/conf/desktop.nix
{ config, pkgs, ... }:
let
iconTheme = pkgs.breeze-icons.out;
themeEnv = ''
# QT: remove local user overrides (for determinism, causes hard to find bugs)
rm -f ~/.config/Trolltech.conf
# GTK3: remove local user overrides (for determinisim, causes hard to find bugs)
rm -f ~/.config/gtk-3.0/settings.ini
# GTK3: add breeze theme to search path for themes
export XDG_DATA_DIRS="${pkgs.libsForQt5.breeze-gtk}/share:$XDG_DATA_DIRS"
# GTK3: add /etc/xdg/gtk-3.0 to search path for settings.ini
# We use /etc/xdg/gtk-3.0/settings.ini to set the icon and theme name for GTK 3
export XDG_CONFIG_DIRS="/etc/xdg:$XDG_CONFIG_DIRS"
# GTK2 theme + icon theme
export GTK2_RC_FILES=${pkgs.writeText "iconrc" ''gtk-icon-theme-name="breeze"''}:${pkgs.libsForQt5.breeze-gtk}/share/themes/Breeze/gtk-2.0/gtkrc:$GTK2_RC_FILES
# SVG loader for pixbuf (needed for GTK svg icon themes)
export GDK_PIXBUF_MODULE_FILE=$(echo ${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)
# LS colors
eval `${pkgs.coreutils}/bin/dircolors "${./dircolors}"`
# QT5: convince it to use our preferred style
export QT_STYLE_OVERRIDE=breeze
'';
in {
environment.extraInit = ''
${themeEnv}
# these are the defaults, but some applications are buggy so we set them
# here anyway
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share
export XDG_CACHE_HOME=$HOME/.cache
'';
# QT4/5 global theme
environment.etc."xdg/Trolltech.conf" = {
text = ''
[Qt]
style=Breeze
'';
mode = "444";
};
# GTK3 global theme (widget and icon theme)
environment.etc."xdg/gtk-3.0/settings.ini" = {
text = ''
[Settings]
gtk-icon-theme-name=breeze
gtk-theme-name=Breeze-gtk
'';
mode = "444";
};
environment.systemPackages = with pkgs; [
# Qt theme
breeze-qt5
# breeze-qt4 # TODO not working any more?
# Icons (Main)
iconTheme # TODO this seems not to work?
# Icons (Fallback)
# hicolor_icon_theme
# TODO put autostart packages here b/c “otherwise icons don't work correctly”?
];
# Make applications find files in <prefix>/share
environment.pathsToLink = [ "/share" ];
}