Cc: @dtzWill
Issue description
First of all, thanks to everyone for working on NixOS.
Awesome 4.3 has a module called beautiful.gtk, it allows
Querying current GTK+ 3 theme via GtkStyleContext.
It can be used for theming, as shown in Awesome's example gtk theme.
However, the current build does not include the typelib files needed by the module making it unusable.
Investigation
The beautiful.gtk implementation uses lgi to obtain Gtk via gobject-introspec
return require('lgi').Gtk
Since the current build does not include the typelib files needed, the above call fails.
After some experimentation, I found out that both gtk3-x11 and atk are needed.
For example:
- run
lua and try to load Gtk: fails with Typelib file for namespace 'Gtk' (any version) not found
$ lua
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> Gtk = require('lgi').Gtk
...26fkq-lua5.2-lgi-0.9.2-1/share/lua/5.2/lgi/namespace.lua:158: Typelib file for namespace 'Gtk' (any version) not found
stack traceback:
[C]: in function 'assert'
...26fkq-lua5.2-lgi-0.9.2-1/share/lua/5.2/lgi/namespace.lua:158: in function <...26fkq-lua5.2-lgi-0.9.2-1/share/lua/5.2/lgi/namespace.lua:155>
(...tail calls...)
stdin:1: in main chunk
[C]: in ?
>
- install
gtk3-x11 (the package that actually includes the typelib file) and add the girepository-1.0 folder to the GI_TYPELIB_PATH environment variable: fails with Typelib file for namespace 'Atk', version '1.0' not found
$ nix-env -iA nixpkgs.gtk3-x11
$ export GI_TYPELIB_PATH=/nix/store/nav1j5p1ac814y47ngiapwzdk75hzly5-gtk+3-3.24.5/lib/girepository-1.0:$GI_TYPELIB_PATH
$ lua
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
>
> g = require('lgi').Gtk
...26fkq-lua5.2-lgi-0.9.2-1/share/lua/5.2/lgi/namespace.lua:158: Typelib file for namespace 'Atk', version '1.0' not found
stack traceback:
[C]: in function 'assert'
...26fkq-lua5.2-lgi-0.9.2-1/share/lua/5.2/lgi/namespace.lua:158: in function <...26fkq-lua5.2-lgi-0.9.2-1/share/lua/5.2/lgi/namespace.lua:155>
(...tail calls...)
stdin:1: in main chunk
[C]: in ?
>
- install
atk and add it to GI_TYPELIB_PATH and finally Gtk loads.
Steps to reproduce
- start Awesome as window manager
- modify
~/.config/awesome/rc.lua to load the example gtk theme
beautiful.init(
gears.filesystem.get_themes_dir() .. "gtk/theme.lua"
)
- restart awesome
- observe the warnings issues by Awesome:
$ journalctl --user --since=today | grep 'GTK'
xsession[28002]: W: awesome: Can't load GTK+3 introspection. Seems like GTK+3 is not installed or `lua-lgi` was built with an incompatible GTK+3 version.
xsession[28002]: W: awesome: Can't load GTK+3 theme. Using 'xresources' theme as a fallback.
Possible solution
I suggest that both atk and gtk-x11 are added as build inputs to the awesome package, I tried this out and it actually works. The catch is that the closure size increases by 123.9M:
So, instead of adding the packages unconditionally, we could add an optional flag, like e.g. withGtkSupport, defaulting to false. In this way, one could always build awesome and add it to services.xserver.windowManager.awesome.package. Ideally one could even add something like awesome-gtk3 to the top level nixpkgs, a bit like gtk3-x11:
|
gtk3-x11 = gtk3.override { |
|
x11Support = true; |
|
}; |
If a decision is made, I'd be happy to submit a PR.
Technical details
- system:
"x86_64-linux"
- host os:
Linux 4.19.36-hardened, NixOS, 19.03.172361.cf3e277dd0b (Koi)
- multi-user?:
yes
- sandbox:
yes
- version:
nix-env (Nix) 2.2.2
- channels(root):
"nixos-19.03.172361.cf3e277dd0b"
- channels(user):
"unstable-19.09pre177249.dfd8f84aef1"
- nixpkgs:
/nix/var/nix/profiles/per-user/root/channels/nixos
awesome 4.3 (Too long)
- Compiled against Lua 5.2.4 (running with Lua 5.2)
- D-Bus support: ✔
- execinfo support: ✔
- xcb-randr version: 1.6
- LGI version: 0.9.2
Cc: @dtzWill
Issue description
First of all, thanks to everyone for working on NixOS.
Awesome 4.3 has a module called beautiful.gtk, it allows
It can be used for theming, as shown in Awesome's example gtk theme.
However, the current build does not include the typelib files needed by the module making it unusable.
Investigation
The beautiful.gtk implementation uses lgi to obtain
Gtkvia gobject-introspecSince the current build does not include the typelib files needed, the above call fails.
After some experimentation, I found out that both
gtk3-x11andatkare needed.For example:
luaand try to load Gtk: fails withTypelib file for namespace 'Gtk' (any version) not foundgtk3-x11(the package that actually includes the typelib file) and add thegirepository-1.0folder to theGI_TYPELIB_PATHenvironment variable: fails withTypelib file for namespace 'Atk', version '1.0' not foundatkand add it toGI_TYPELIB_PATHand finallyGtkloads.Steps to reproduce
~/.config/awesome/rc.luato load the example gtk themePossible solution
I suggest that both
atkandgtk-x11are added as build inputs to the awesome package, I tried this out and it actually works. The catch is that the closure size increases by 123.9M:build awesome without gtk3-x11 and atk
nix path-info ./result | grep awesome-> 99.6Mbuild awesome with gtk3-x11 and atk
nix path-info ./result | grep awesome-> 223.4MSo, instead of adding the packages unconditionally, we could add an optional flag, like e.g.
withGtkSupport, defaulting to false. In this way, one could always build awesome and add it toservices.xserver.windowManager.awesome.package. Ideally one could even add something likeawesome-gtk3to the top levelnixpkgs, a bit likegtk3-x11:nixpkgs/pkgs/top-level/all-packages.nix
Lines 10312 to 10314 in 6d7ed96
If a decision is made, I'd be happy to submit a PR.
Technical details
"x86_64-linux"Linux 4.19.36-hardened, NixOS, 19.03.172361.cf3e277dd0b (Koi)yesyesnix-env (Nix) 2.2.2"nixos-19.03.172361.cf3e277dd0b""unstable-19.09pre177249.dfd8f84aef1"/nix/var/nix/profiles/per-user/root/channels/nixosawesome 4.3 (Too long)