question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello! Me again! Sorry about that! 😅

I’d like to custom-build the python-based qtile window manager, but I don’t quite know how to override or merge the derivation below with the default package; with xonsh, there was the package option, but there’s nothing similar for qtile.

let

  # mach-nix = import (builtins.fetchGit {
  #  url = "https://github.com/DavHau/mach-nix/";
  #  ref = "refs/tags/2.3.0";
  # });
  mach-nix = import ../../extras/mach-nix;
  pkgs = mach-nix.nixpkgs;

  # build the xonsh package similar like in nixpkgs
  qtile_pkg = with pkgs.qtile; mach-nix.buildPythonPackage {
    inherit src LC_ALL postPatch postInstall passthru;
    # inherit src LC_ALL postPatch postInstall passthru pythonPath;
    add_requirements = ''
      # cairocffi-xcffib
      cairocffi
      setuptools
      setuptools_scm
      xcffib

      # From https://github.com/NixOS/nixpkgs/issues/45039
      dateutil
      dbus-python
      iwlib
      keyring
      mpd2
      psutil
      pythonwifi
      pyxdg

      # add requirements here
      # ...
    '';
  };

  # build environment with xonsh + python packages from arbitrary sources
  qtile_env = mach-nix.mkPython {
    extra_pkgs = [
      qtile_pkg
      "https://gitlab.com/picotech/nanotech/nanite/-/archive/master/nanite-master.tar.gz"
    ];
  };

  # wrap it again to set the passthru variable correctly
  qtile_wm = with pkgs.qtile; pkgs.buildEnv {
    inherit name passthru;
    paths = [ qtile_env ];
  };

in qtile_wm

Thank you kindly for the help!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:52 (52 by maintainers)

github_iconTop GitHub Comments

1reaction
DavHaucommented, Oct 8, 2020

No worries. Always happy to help. Looking forward to merge your examples!

1reaction
DavHaucommented, Oct 3, 2020

Looks fine to me. Didn’t test though

On October 4, 2020 2:32:57 AM GMT+07:00, Jeet Ray notifications@github.com wrote:

I’m assuming something like this won’t work, imported using config.nixpkgs.overlays = [(self: super: { qtile = import ./qtile.nix { inherit pkgs; }; })], correct?

{ pkgs, ... }:
let
 qtileOverlay = {pkgs, ...}:
   let
     mach-nix = import (builtins.fetchGit {
       url = "https://github.com/DavHau/mach-nix/";
       rev = "393cdb9d8f0fe58b17ea59920359e5bfb8e36534";
     });
     # mach-nix = import ../../extras/mach-nix;

     # build a mach-nix python env
     machnixPy = mach-nix.mkPython {
       extra_pkgs = [
         "https://github.com/psf/requests/tarball/v2.22.0"
"https://gitlab.com/picotech/nanotech/nanite/-/archive/master/nanite-master.tar.gz"
"https://files.pythonhosted.org/packages/bc/ab/c49f97516f78c2b0cacb4f45873abc4ca9872942a9c4c19ded8052c8edda/python-wifi-0.6.1.tar.bz2"
       ];
       requirements = ''
         iwlib
       '';
       python = "python38";
       inherit pkgs;
       _.iwlib.buildInputs.add = [ pkgs.wirelesstools ];
     };

     # get mach-nix modified nixpkgs
     newPkgs = machnixPy.nixpkgs;

     ### modify the qtile package
     pythonPackages = newPkgs.python38.pkgs;
     # switch qtile to python 3.8
     qtile_py_38 = newPkgs.qtile.override {
       python37Packages = newPkgs.python38Packages;
     };
     # add extra packages to PYTHONPATH of qtile
     qtile_with_pkgs = qtile_py_38.overrideAttrs (oa: {
       pythonPath =
         oa.pythonPath
         ++ machnixPy.selectPkgs pythonPackages
         ++ (with pythonPackages; [
           # From https://github.com/NixOS/nixpkgs/issues/45039
           dateutil
           dbus-python
           keyring
           mpd2
           psutil
           pyxdg
         ]);
     });

     # make a final overlay with the modified qtile
     finalOverlay = self: super: { qtile = qtile_with_pkgs; };
   in
   finalOverlay;
in

let
 pkgs = import (builtins.fetchTarball {
url =
"https://github.com/nixos/nixpkgs-channels/tarball/84d74ae9c9cbed73274b8e4e00be14688ffc93fe";
   sha256 = "0ww70kl08rpcsxb9xdx8m48vz41dpss4hh3vvsmswll35l158x0v";
 }) { config = {}; overlays = [];};
 overlay = qtileOverlay { inherit pkgs; };
in
 (import pkgs.path { overlays = [ overlay ]; }).qtile

– You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/DavHau/mach-nix/issues/125#issuecomment-703154183

– Sent from my Android device with K-9 Mail. Please excuse my brevity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Everything you need to know about Qtile — Qtile 0.22.2.dev0+ ...
Everything you need to know about Qtile¶. Getting started¶. Installing Qtile · Configuration · Troubleshooting · As a Wayland Compositor · Shell commands ......
Read more >
Qtile - ArchWiki
Qtile is simple, small, and extensible. It is easy to write your own layouts, widgets, and built-in commands. It is written and configured...
Read more >
Qtile - Getting Started And Setting Workspaces - YouTube
Are you wanting to try out the Qtile tiling window manager but you are ... https://gitlab.com/dwt1 FREE AND OPEN SOURCE SOFTWARE THAT I...
Read more >
Qtile - Gentoo Wiki
Qtile · 1 Installation. 1.1 USE flags; 1.2 Emerge · 2 Qtile as a Wayland Compositor. 2.1 Support for X11 applications (XWayland) ·...
Read more >
Qtile Documentation - Read the Docs
All widget-* useflags are disabled by default because these widgets require additional dependencies while not everyone will use them. Enable only widgets you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found