NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.41k stars 14.36k forks source link

Build failure: qtile #252320

Closed misumisumi closed 1 year ago

misumisumi commented 1 year ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build qtile

Build log

https://gist.github.com/misumisumi/593302920c2f33a21cb65d69f9875bfe

Additional context

The issue is related to that raised in qtile/qtile#4346. Here is what I used to make the build pass using override. I would be happy if you could use it as a reference.

  (final: prev: {
    python3 = prev.python3.override {
      packageOverrides = pfinal: pprev: {
        qtile = pprev.qtile.overrideAttrs (old:
          let
            _xcffib =
              let
                pname = "xcffib";
                version = "1.5.0";
              in
              pprev.${pname}.overrideAttrs (old: {
                inherit pname version;
                patches = [ ];
                src = prev.fetchPypi {
                  inherit pname version;
                  hash = "sha256-qVyUZfL5e0/O3mBr0eCEB6Mt9xy3YP1Xv+U2d9tpGsw=";
                };
              });
            _pywlroots =
              let
                pname = "pywlroots";
                version = "0.16.4";
              in
              pprev.${pname}.overrideAttrs (old: {
                inherit pname version;
                buildInputs = with prev; [ libinput libxkbcommon pixman xorg.libxcb udev wayland wlroots_0_16 ];
                src = prev.fetchPypi {
                  inherit pname version;
                  hash = "sha256-+1PILk14XoA/dINfoOQeeMSGBrfYX3pLA6eNdwtJkZE=";
                };
              });
          in
          {
            src = prev.fetchFromGitHub {
              owner = "qtile";
              repo = "qtile";
              rev = "5711b5e7759c46a3c8a3fbf5e47ed767e91f3821";
              hash = "sha256-H7ffTytfQVAFY5AfyC+wLwGFtuvCMGQZ2O5eG4hvpA4=";
            };
            postPatch = old.postPatch + ''
              substituteInPlace libqtile/backend/wayland/cffi/cairo_buffer.py \
                --replace drm_fourcc.h libdrm/drm_fourcc.h
            '';
            buildInputs = with prev; [
              libinput
              wayland
              wlroots_0_16
              libxkbcommon
              libdrm
            ];
            propagatedBuildInputs = with prev; with pprev; [
              _xcffib
              (cairocffi.override { withXcffib = true; xcffib = _xcffib; })
              python-dateutil
              dbus-python
              dbus-next
              mpd2
              psutil
              pyxdg
              pygobject3
              pywayland
              _pywlroots
              xkbcommon
              pulseaudio
            ];
          });
      };
    };
  })

Notify maintainers

@kamilchm @arjan-s

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.4.12, NixOS, 23.11 (Tapir), 23.11.20230825.5690c42`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(sumi): `""`
 - channels(root): `"nixos, nixpkgs"`
 - nixpkgs: `/home/sumi/.nix-defexpr/channels/nixpkgs`
arjan-s commented 1 year ago

You're trying to build Qtile from the git repo, which is not possible with some specific changes to your overlay. Please take a look at my (working) version for ideas: https://gist.github.com/arjan-s/bc942826ff1d2e5e60430740fef912fd#file-overlay_qtile_master-nix-L35

musjj commented 1 year ago

@arjan-s

It'd be really cool if you can make an overlay flake for it!

musjj commented 1 year ago

Made my own concise version of the overlay (the Wayland backend is untested):

final: prev: {
  python3 = prev.python3.override {
    packageOverrides = pythonFinal: pythonPrev: {
      qtile = pythonPrev.qtile.overrideAttrs (oldAttrs: {
        version = "unstable-2023-09-04";
        src = oldAttrs.src.override {
          rev = "f45dc910ada928dae63b9db7ae89bf4c285909a8";
          hash = "sha256-8hUW3TRwja+K0PAzKPo2UWCk8AbVy1f+8zfH3OOoSo8=";
        };

        propagatedBuildInputs =
          let
            xcffib = pythonFinal.xcffib.overrideAttrs (oldAttrs: rec {
              version = "1.5.0";
              patches = [ ];
              src = oldAttrs.src.override {
                inherit version;
                hash = "sha256-qVyUZfL5e0/O3mBr0eCEB6Mt9xy3YP1Xv+U2d9tpGsw=";
              };
            });
          in
          with final; with pythonFinal; [
            (pywlroots.overridePythonAttrs (oldAttrs: rec {
              version = "0.16.4";
              src = oldAttrs.src.override {
                inherit version;
                hash = "sha256-+1PILk14XoA/dINfoOQeeMSGBrfYX3pLA6eNdwtJkZE=";
              };
              buildInputs = [ wlroots_0_16 ] ++ lib.remove wlroots oldAttrs.buildInputs;
            }))
            xcffib
            (cairocffi.override { withXcffib = true; inherit xcffib; })
          ] ++ lib.remove
            (cairocffi.override { withXcffib = true; })
            (lib.remove pywlroots oldAttrs.propagatedBuildInputs);

        buildInputs = with final; [
          wlroots_0_16
          libdrm
        ] ++ lib.remove wlroots oldAttrs.buildInputs;

        postPatch = with final; oldAttrs.postPatch + ''
          substituteInPlace libqtile/backend/wayland/cffi/cairo_buffer.py \
            --replace drm_fourcc.h libdrm/drm_fourcc.h

          substituteInPlace libqtile/backend/wayland/cffi/build.py \
            --replace /usr/include/pixman-1 ${pixman.outPath}/include \
            --replace /usr/include/libdrm ${libdrm.dev.outPath}/include/libdrm
        '';
      });
    };
  };
}