Nix shell with python env with libqtile for qtile config hacking

In the source tree of my system/home flake I thought to be smart and wanted to spawn a dev shell with direnv pointing to the following shell.nix:

{ pkgs ? import <nixpkgs> { } }:

pkgs.mkShell {
  name = "qtile-dev-shell";
  # just take the list from https://github.com/NixOS/nixpkgs/blob/f42a45c015f28ac3beeb0df360e50cdbf495d44b/pkgs/applications/window-managers/qtile/default.nix#L49
  buildInputs = with pkgs.qtile; propagatedBuildInputs ++ buildInputs ++ nativeBuildInputs;
}

with the (naive?) expectation that the python in this shell would have everything I need (including references to the correct site-packages picked up by pylance).

But this doesn’t seem to be the case. Is there a trivial/idiomatic way to get a dev shell that gets me the correct env for a qtile config?

Instead you might want to use inputsFrom = [ qtile ]

1 Like

Thanks, didn’t yet know that one.

However, I seem to have made a mistake at another level in this case, since apparently libqtile is an integral part of qtile (and not an input), there’s even no such thing as a separate libqtile it appears…

That means qtile itself has to be an input of the shell, then it works…

Cheers

1 Like

hey i need help setting up test environment for my qtile in nix os using shell.nix i am using x11 as backend. can you help me with this i am having trouble setting it up. maybe share your shell.nix file.

i have opened an issue regarding this .
my thread

any help would be nice

I checked a shell.nix I found with my old qtile config (it’s more than a year old by now, I moved on to Hyprland), and it’s only this, which apparently worked for me at the time:

{ pkgs ? import <nixpkgs> { } }:

pkgs.mkShell {
  name = "qtile-dev-shell";
  buildInputs = with pkgs; [ qtile ];
}