Qtile and widgets

Hello,

I am relatively new in linux world and I treat it generally like a hobby. I tried couple of distros. I hope that’s my last distro I use:) I am fan of Qtile.
When I successfully installed NixOS the problem appear - Qtile widgets don’t work. For example, the widget showing the CPU load shows Import Error: CPU. Similar situation is with others widget connected to hardware (memory, network adapter). Date widget works fine :slight_smile:
I am looking for packages I should install but so far I haven’t found a solution. As I see Qtile isn’t very popular and maybe that’s why it’s not that easy to find example config;)
On Arch and Debian distros my Qtile config file worked.

Here is what programs I included in my `configuration.nix’:

neovim
ranger
ueberzug

gnome3.gnome-keyring
gnome3.seahorse

tk
jupyter
gcc

exercism
vscode
arduino>
jetbrains.pycharm-community
texlive.combined.scheme-full
texstudio
docker-compose
zoom-us
teams
blender
darktable
gimp
krita
dotnet-sdk_3
bmon
htop
nvtop
iotop
lm_sensors
alacritty
vim
zsh
fzf
xsel # for copying
clipmenu # for copying
mc
pciutils
unzip
firefox
geckodriver
firmwareLinuxNonfree
microcodeIntel
wget
curl
git
rsync
tree
feh # picture viewer
mpv # video player
libdvdcss # plugin to play cd/dvd in mpv

                                        # for qtile?	
                                        python37Packages.dbus-python
                                        python37Packages.xlib
                                        psutils
                                        python37Packages.psutil
                                        python37Packages.xcffib
                                        python37Packages.cairocffi
                                        #python37Packages.python-dbusmock
                                        python37Packages.pip
                                        python37Packages.autopep8
                                        python37Packages.flake8
                                        doas

Thanks in advance for help in finding missing packages or other solution :slight_smile:

So because of the way nix installs python packages you have to explicitly add those dependencies to the qtile package. Adding them to with systemPackages or other ways won’t give qtile access to them.

What nixos version are you on? Can you post the output of nixos-version here. Because I think a lot of the optional dependencies were added in this pr: qtile: add missing python package dependencies by vividn · Pull Request #99538 · NixOS/nixpkgs · GitHub.

So your problem might already be fixed with a nix channel update.
But if some are still missing, you can use this code in your configuration.nix to add more:

nixpkgs.overlays = [
  (self: super: {  
    qtile = super.qtile.overrideAttrs(oldAttrs: {  
      pythonPath = oldAttrs.pythonPath ++ (with self.python37Packages; [  
        # Add other python dependencies here  
      ]);
    });  
  })  
];  
~

Thanks for response :slight_smile:
Well, I am not familiar with overlays yet, but I understand the idea as you explained.

I am using:

20.09.2290.647cc06986c (Nightingale)

so it is quite fresh stable version.

I tried to apply overlay based on yours:

 nixpkgs.overlays = [
       (self: super: {
       qtile = self.nixpkgs-master.qtile.overrideAttrs(oldAttrs: {
       pythonPath = oldAttrs.pythonPath ++ (with self.python37Packages; [
              psutil
              dbus-python              
              keyring
             ]);
            });
           })
         ];

but I’ve got error as follow:

error: attribute ‘nixpkgs-master’ missing, at /etc/nixos/configuration.nix:453:39

I am not sure what is going on but I am going to try to investigate this subject tomorrow with fresh head :slight_smile:

Just in case I put my configuration file on GitHub.

1 Like

Oh sorry I messed up the code. Its not self.nixpkgs-master.qtille its just super.qtile. I edited my comment above.

And yeah I think you should have the code from that PR, so maybe you just need to add more dependencies.

All right, it works!

Finally I added to configuration.nix file following lines:

nixpkgs.overlays = [
                          (self: super: {
                              qtile = super.qtile.overrideAttrs(oldAttrs: {
                              pythonPath = oldAttrs.pythonPath ++ (with self.python37Packages; [
                              keyring
                              xcffib
                              #cairocffi-xcffib
                              setuptools
                              setuptools_scm
                              dateutil
                              dbus-python
                              mpd2
                              psutil
                              pyxdg
                              pygobject3
                            ]);
                          });
                        })];

and the widgets are working :slight_smile:

Thank you for help.

2 Likes

I haven’t been able to get desktop notifications working. Notifications should be created by clicking the Pomodoro widget.

When I look in ~/.local/share/qtile/qtile.log I see lots of messages saying Notify isn’t available.

ERROR libqtile utils.py:send_notification():L236 Namespace Notify not available

On IRC, folks in #qtile said the necessary packages on ubuntu are called

gir1.2-gtk-3.0
gir1.2-notify-0.7
gir1.2-gudev-1.0

(or maybe only the notify one is necessary).

so I tried adding equivalent packages with

{ qtile, libnotify, gtk3-x11, gnome3}:

qtile.overridePythonAttrs ({buildInputs, ...}:
  {
    propagatedBuildInputs = buildInputs ++ [libnotify gtk3-x11 gnome3.libgudev];
  })

but it didn’t help, the error messages persist and the notifications don’t work.

Can anybody suggest how to get notifications working?