hyprwm / aquamarine

Aquamarine is a very light linux rendering backend library
BSD 3-Clause "New" or "Revised" License
281 stars 21 forks source link

Fail to build on NixOS after libinput overlay removal #73

Open sjcobb2022 opened 3 months ago

sjcobb2022 commented 3 months ago

After https://github.com/hyprwm/aquamarine/commit/cff00196f0fcf734a2bf164eb0dfdb6e58c5c906

Aquamarine no longer builds for me on nixos.

Here is the error:

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/79ixzxfc4c0ng5xf53wx8iyajk3lcdxl-hiqq0j5lq9wddwhyxii4jwxyhsk96f6z-source
source root is hiqq0j5lq9wddwhyxii4jwxyhsk96f6z-source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_>
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/43m1ckc0kivkq37xbm3l7gva8k3plwyf-gcc-wrapper-13.2.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/43m1ckc0kivkq37xbm3l7gva8k3plwyf-gcc-wrapper-13.2.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /nix/store/brnclrxnf277km61a4ksmqcwz5idrz6n-pkg-config-wrapper-0.29.2/bin/pkg-config (found version "0.29.2")
-- Found OpenGL: /nix/store/kswiznzih5sj5qy99nv18r3h4hhs6cl4-libGL-1.7.0/lib/libOpenGL.so  found components: GLES2
-- Checking for modules 'libseat>=0.8.0;libinput>=1.26.0;wayland-client;wayland-protocols;hyprutils>=0.1.5;pixman-1;libdrm;gbm;libudev;libdisplay-info;hwdata'
--   Requested 'libinput >= 1.26.0' but version of Libinput is 1.25.0
CMake Error at /nix/store/28s979fhz8d6h1rny3n5zh1ybmby6kjz-cmake-3.29.2/share/cmake-3.29/Modules/FindPkgConfig.cmake:634 (message):
  The following required packages were not found:

   - libinput>=1.26.0

Call Stack (most recent call first):
  /nix/store/28s979fhz8d6h1rny3n5zh1ybmby6kjz-cmake-3.29.2/share/cmake-3.29/Modules/FindPkgConfig.cmake:862 (_pkg_check_modules_internal)
  CMakeLists.txt:24 (pkg_check_modules)

I guess still needs the overlay? @fufexan

fufexan commented 3 months ago

Are you overriding the nixpkgs input by any chance?

sjcobb2022 commented 3 months ago

Are you overriding the nixpkgs input by any chance?

Yes, because it fails to build 0.42 without overriding. https://github.com/hyprwm/Hyprland/issues/6967#issuecomment-2267625936

fufexan commented 3 months ago

Makes sense then. I wanted to backport libinput 1.26 to NixOS 24.05 but some committers deemed it a breaking change (with more recursive breakages). I think the best option for you currently is to manually add the overlay.

I've removed it due to it causing mass rebuilds for people using hyprland through the overlay.

sjcobb2022 commented 3 months ago

Makes sense then. I wanted to backport libinput 1.26 to NixOS 24.05 but some committers deemed it a breaking change (with more recursive breakages). I think the best option for you currently is to manually add the overlay.

I've removed it due to it causing mass rebuilds for people using hyprland through the overlay.

Yeh that makes sense. I could also just pin hyprland/aquamarine to b4 the change was made.

sjcobb2022 commented 2 months ago

@fufexan

You know any way to add an overlay that affects the build of an external flake. Simply overriding aquamarine / libinput has not been successful for me.

This is what I have tried so far. Any thoughts on getting this to work? Or do you think that pinning until 24.11 is good enough.

       aquamarine = prev.aquamarine.override {
         libinput = prev.libinput.overrideAttrs (self: super: {
           version = "1.26.0";
           src = final.fetchFromGitLab {
             domain = "gitlab.freedesktop.org";
             owner = "libinput";
             repo = "libinput";
             rev = self.version;
             hash = "sha256-mlxw4OUjaAdgRLFfPKMZDMOWosW9yKAkzDccwuLGCwQ=";
           };
         });
       };
     };
         libinput = prev.libinput.overrideAttrs (self: super: {
           version = "1.26.0";
           src = final.fetchFromGitLab {
             domain = "gitlab.freedesktop.org";
             owner = "libinput";
             repo = "libinput";
             rev = self.version;
             hash = "sha256-mlxw4OUjaAdgRLFfPKMZDMOWosW9yKAkzDccwuLGCwQ=";
           };
         });
       };
fufexan commented 2 months ago

That looks good at first sight, but perhaps other dependencies of aquamarine also depend on libinput. I believe a "global" overlay might fix this, but it will also require you to rebuild some other packages.

sjcobb2022 commented 2 months ago

This is actually a global overlay. And it still fails with the aquamarine PkgConfig.cmake failing. Bit strange.

  nixpkgs = {
    overlays = builtins.attrValues outputs.overlays;
  }; 

I have this section of nix in both my home-manager and my system level config.

I believe that that should totally override it.

Perhaps I will also need to set nixpkgs.config.packageOverrides?

fufexan commented 2 months ago

Not sure, but it's worth a try.

sjcobb2022 commented 2 months ago

Ok I have a fix, couple of weird behaviors with wayland-scanner but it's all good.

So:

With these inputs:

 inputs = {
    aquamarine = {
      type = "git";
      url = "https://github.com/hyprwm/aquamarine";
      ref = "refs/tags/v0.4.1";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    hyprland = {
      type = "git";
      url = "https://github.com/hyprwm/hyprland";
      ref = "refs/tags/v0.43.0";
      submodules = true;
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.aquamarine.follows = "aquamarine";
    };
  }

I have this overlay:

  modifications = final: prev: {
    hyprland-patched = let
      libinput = prev.libinput.overrideAttrs (self: {
        name = "libinput";
        version = "1.26.0";
        src = final.fetchFromGitLab {
          domain = "gitlab.freedesktop.org";
          owner = "libinput";
          repo = "libinput";
          rev = self.version;
          hash = "sha256-mlxw4OUjaAdgRLFfPKMZDMOWosW9yKAkzDccwuLGCwQ=";
        };
      });
    in
      inputs.hyprland.packages.${prev.system}.hyprland.override {
        libinput = libinput;
        aquamarine = inputs.hyprland.inputs.aquamarine.packages.${prev.system}.aquamarine.override {
          libinput = libinput;
        };
        # need this to fix meson build for some reason?
        wayland-scanner = final.unstable.wayland-scanner;
      };
   };

Where final.unstable is from my unstable overlay:

  unstable-packages = final: _prev: {
    unstable = import inputs.nixpkgs-unstable {
      inherit (final) system;
      config.allowUnfree = true;
    };
  };

Important to note: using unstable wayland-scanner and unstable nixpkgs for aquamarine.