Something broke my system, how to tell exactly what caused it?

Hi. I noticed today some issues with my nixos. My hyprpaper script stopped working giving me this error:

Couldn’t connect to /run/user/1000/hypr/2ccd45a84475fab46c6fecd2fe226d3173104743_1716215375_441147023/.hyprpaper.sock. (3)

Also (I am using Hyprland btw.) when I use Blender for example, every time I do some action, my mouse pointer disappears and I need to swipe to different window and back to blender to reapear.

I pinpointed exact commit in nixpkgs that breaks it. When I use this version in my flake.nix, it works correctly:

Next commit breaks it:

I suppose that between that time (2:24PM - 2:27PM), there was some update of couple of packages (nixos downloaded them when I switched between those versions). I strongly suppose that there was some hyprland update or something but how can I tell? Is there any way to know what packages were updated between this time? Or how can one proceed if something like that occurs? How can I find the culprit?

Thanks a lot for your help. I am using nixos for couple of months now so I am not as experienced in it so far.

Any help please? Or some place I can learn more about this stuff? Thanks a lot

This might be a relevant issue:

But I also found a post where it was suggested that it might be configuration issue:

https://reddit.com/r/hyprland/comments/12z3o62/hyprpaper_not_running/

Edit: Searching those two nixpkgs commits, it doesn’t seem that there were any updates to hyprpaper:

$ nix search "github:NixOS/nixpkgs/def1398f86987078be87169c68a71b628a4bd78b" hyprpaper
* legacyPackages.x86_64-linux.hyprpaper (0.6.0)
$ nix search "github:NixOS/nixpkgs/0d71372195679eb949283ecaacde0daa71b5bd78" hyprpaper
* legacyPackages.x86_64-linux.hyprpaper (0.6.0)
  A blazing fast wayland wallpaper utility

hyprland-wise, these seem to be the only differences:

hyprland search comparison
$ nix search "github:NixOS/nixpkgs/0d71372195679eb949283ecaacde0daa71b5bd78" hyprland > hyprland.broken.log
$ nix search "github:NixOS/nixpkgs/def1398f86987078be87169c68a71b628a4bd78b" hyprland > hyprland.working.log
$ diff hyprland.working.log hyprland.broken.log
19c19
< * legacyPackages.x86_64-linux.hyprland (0.39.1)
---
> * legacyPackages.x86_64-linux.hyprland (0.40.0-unstable-2024-05-12)
53a54,56
>
> * legacyPackages.x86_64-linux.hyprwayland-scanner (0.3.7)
>   A Hyprland version of wayland-scanner in and for C++
  • hyprland: 0.39.1 → 0.40.0-unstable-2024-05-12
  • hyprwayland-scanner: init at 0.3.70.40.0

According to the GitHub issue, updating hyprpaper from 0.6.0 to 0.7.0 might be necessary for it to function correctly for hyprland 0.40.0

Edit 2: Yup, a PR is already under way to fix this:

Edit 3: You can track the PR here, and as it might take some time to reach nixos-unstable, you might want to use an overlay in the meantime:

  nixpkgs.overlays = [
    (final: prev: {
      hyprpaper = prev.hyprpaper.overrideAttrs rec {
        version = "0.7.0";
        src = prev.fetchFromGitHub {
          owner = "hyprwm";
          repo = prev.pname;
          rev = "v${version}";
          hash = "sha256-l13c8ALA7ZKDgluYA1C1OfkDGYD6e1/GR6LJnxCLRhA=";
        };
      };
    })
  ];
2 Likes

Thanks a lot. With that nix search command you answered my question how to tell what is different between specific commits.

So I would say this change: hyprland: 0.39.1 → 0.40.0-unstable-2024-05-12 is probably also the reason why Im having some strange behavior in Blender right? So probably what I should do is to overlay whole hyprland for a moment?

1 Like

If you didn’t have any issues with hyprland 0.39.1, then yes. Just pinning it with an overlay will probably solve everything for now. However, I don’t know if that would stay true as other components get updated (for example hyprpaper 0.6.0 → 0.7.0), so you might have to pin them as well in that case, or by that time hyprland 0.40.0 would be fine to use.

1 Like

Yes, I understand now how this works. Thanks a lot again. All you said and did was so much helpful.

1 Like

You’re welcome :grin:

Happy nixing :snowflake:

1 Like

Can I ask one more question? I am now trying to make it work somehow. I have found that this issue was already discussed in hyprland issues and was solved by this: cursor: minor fixes for unhiding surfaces · hyprwm/Hyprland@4cdddcf · GitHub

So I am trying to somehow use overlay using this commit by:

  nixpkgs.overlays = [
    (final: prev: {
      hyprland = prev.hyprland.overrideAttrs rec {
        src = prev.fetchFromGitHub {
          owner = "hyprwm";
          repo = "Hyprland";
          rev = "4cdddcfe466cb21db81af0ac39e51cc15f574da9";
          hash = "sha256-bgXvHS/Gj6RZTes0oWXziQ7CJbLJWvu/xDei117tZro=";
        };
      };
    })
  ];

But it won’t build:

> error: builder for '/nix/store/8p8x0lkzgangbflryzhjdf951lxjcd5w-hyprland-0.40.0-unstable-2024-05-12.drv' failed with exit code 1;
>        last 10 log lines:
>        > -- Setting precompiled headers
>        > -- Setting link libraries
>        > Could not open input file: No such file or directory
>        > Could not open input file: No such file or directory
>        > Could not open input file: No such file or directory
>        > Could not open input file: No such file or directory
>        > Couldn't load proto
>        > -- Checking for module 'tomlplusplus'
>        > --   Found tomlplusplus, version 3.4.0
>        > -- Configuring incomplete, errors occurred!
>        For full logs, run 'nix log /nix/store/8p8x0lkzgangbflryzhjdf951lxjcd5w-hyprland-0.40.0-unstable-2024-05-12.drv'.
> error: 1 dependencies of derivation '/nix/store/s17v2a8q144fr4nn0ja66w5rm4i6aq7k-desktops.drv' failed to build
> error: 1 dependencies of derivation '/nix/store/pb1kj5aiii4mv753f6v56lwii7qp5q9k-hyprland-0.40.0-unstable-2024-05-12_fish-completions.drv' failed to build
> error: 1 dependencies of derivation '/nix/store/iazbzwqxniyppsy5phxnwbg0qzzh1y63-man-paths.drv' failed to build
> error: 1 dependencies of derivation '/nix/store/0fkmb3nk2w9p3c0jfgn0nrcr2m8xkzv1-system-path.drv' failed to build
> error: 1 dependencies of derivation '/nix/store/y92nh77wnfgmg0fl2z4c13aqni2hsh4l-xdg-desktop-portal-hyprland-1.3.1.drv' failed to build
> error: 1 dependencies of derivation '/nix/store/ssmnpr6qcbyp84m0zmgkkhn7jvr54gms-nixos-system-nixos-24.05.20240521.3eaeaeb.drv' failed to build

What is the correct approach here?

The cursor issue probably doesn’t exist in hyprland 0.39.1 as the commit that introduced it came later. So if you’re trying to pin the version to 0.39.1, all you need to do is:

  nixpkgs.overlays = [
    (final: prev: {
      hyprland = prev.hyprland.overrideAttrs (old: rec {
        version = "0.39.1";
        src = prev.fetchFromGitHub {
          owner = "hyprwm";
          repo = old.pname;
          fetchSubmodules = true;
          rev = "v${version}";
          hash = "sha256-7L5rqQRYH2iyyP5g3IdXJSlATfgnKhuYMf65E48MVKw=";
        };
      });
    })
  ];

From your overlay, you’re still trying to build hyprland 0.40.0 and you forgot to include the submodules with fetchSubmodules = true;

No, I’m trying to use version from nixpkgs but with this patched, if that is possible

Oh, in that case you can just apply the patch directly:

    (final: prev: {
      hyprland = prev.hyprland.overrideAttrs {
        patches = [
          (pkgs.fetchpatch {
            name = "hyprland-fix-cursor.patch";
            url = "https://github.com/hyprwm/Hyprland/commit/4cdddcfe466cb21db81af0ac39e51cc15f574da9.patch";
            sha256 = "sha256-eKODLcmqLgxkARVophY/lZkMZpIWDLEkt1nCzd41vyg=";
          })
        ];
      };
    })
1 Like

You are again absolutelly correct. Thanks. Where can I learn this stuff? I was trying following this: Overlays - NixOS Wiki, but it also gave me errors with dependencies

1 Like

The best way to learn is with time and experience to be honest. Just like this one :grin:

1 Like

Ok, will do :smiley: Thanks again a thousand times.

1 Like

Also, you should check out nix.dev if you haven’t, already. It has some pretty nice learning material that I found both useful and easy to follow.

2 Likes

Okay, thanks for the link. Will definitely check it out.

Can I ask you again my friend? I am again unable to find solution to my problem. For a time, I was using that patch:

    (final: prev: {
      hyprland = prev.hyprland.overrideAttrs {
        patches = [
          (pkgs.fetchpatch {
            name = "hyprland-fix-cursor.patch";
            url = "https://github.com/hyprwm/Hyprland/commit/4cdddcfe466cb21db81af0ac39e51cc15f574da9.patch";
            sha256 = "sha256-eKODLcmqLgxkARVophY/lZkMZpIWDLEkt1nCzd41vyg=";
          })
        ];
      };
    })

But after today’s flake update and attempt to rebuild, I am getting this:

error: builder for '/nix/store/prs9dq4aa6sii1ydb5x034q0zvphx3wg-hyprland-0.40.0-unstable-2024-05-05.drv' failed with exit code 1;
       last 10 log lines:
       > --------------------------
       > |--- a/src/managers/PointerManager.cpp
       > |+++ b/src/managers/PointerManager.cpp
       > --------------------------
       > File to patch:
       > Skip this patch? [y]
       > Skipping patch.
       > 1 out of 1 hunk ignored
       > patching file src/render/Renderer.cpp
       > Hunk #1 succeeded at 2255 with fuzz 1.
       For full logs, run 'nix log /nix/store/prs9dq4aa6sii1ydb5x034q0zvphx3wg-hyprland-0.40.0-unstable-2024-05-05.drv'.
error: 1 dependencies of derivation '/nix/store/nmiv2nsipwv5hah4mkwfq74p56g637sj-desktops.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ick82182a8m6c610sargyllssxy9jv8x-hyprland-0.40.0-unstable-2024-05-05_fish-completions.drv' failed to build
error: 1 dependencies of derivation '/nix/store/plzcky7kn7ksgmdhgfvjbrpw7wqrizpf-man-paths.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9wp4kwg25xnlxxwpjxdiqc9j9mv5y0rq-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wvpg9vrmycl20yy3w3giv2jwn6xxlmvx-xdg-desktop-portal-hyprland-1.3.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fygjs2718mnq6virlbh9rwv39igq8azj-nixos-system-nixos-24.11.20240527.9ca3f64.drv' failed to build

I maybe supposed that this patch was already included (not sure if I am right), so I removed the overlay and then the system builds. Original problem is gone, but there are new problems in hyprland, so I tried to pin my version to that 0.39.1 that hadn’t any problems with your code:

    (final: prev: {
      hyprland = prev.hyprland.overrideAttrs (old: rec {
        version = "0.39.1";
        src = prev.fetchFromGitHub {
          owner = "hyprwm";
          repo = old.pname;
          fetchSubmodules = true;
          rev = "v${version}";
          hash = "sha256-7L5rqQRYH2iyyP5g3IdXJSlATfgnKhuYMf65E48MVKw=";
        };
      });
    })

But it does not work either:

error: builder for '/nix/store/914ndfhzh9yglp1h1bpr639k9kp91g8p-hyprland-0.39.1.drv' failed with exit code 1;
       last 10 log lines:
       > [117/120] Building CXX object CMakeFiles/Hyprland.dir/src/render/decorations/CHyprGroupBarDecoration.cpp.o
       > [118/120] Building CXX object CMakeFiles/Hyprland.dir/src/render/decorations/DecorationPositioner.cpp.o
       > [119/120] Building CXX object CMakeFiles/Hyprland.dir/src/render/Renderer.cpp.o
       > [120/120] Linking CXX executable Hyprland
       > buildPhase completed in 1 minutes 26 seconds
       > Running phase: glibPreInstallPhase
       > Running phase: installPhase
       > install flags: -j16 install
       > [0/2] Re-checking globbed directories...
       > ninja: error: unknown target 'install'
       For full logs, run 'nix log /nix/store/914ndfhzh9yglp1h1bpr639k9kp91g8p-hyprland-0.39.1.drv'.
error: 1 dependencies of derivation '/nix/store/hkp9i612b297y3xvzdd7m8rb2akkzsiv-desktops.drv' failed to build
error: 1 dependencies of derivation '/nix/store/chczq3a0djxc7qpj27q91bm99ib91c0z-hyprland-0.39.1_fish-completions.drv' failed to build
error: 1 dependencies of derivation '/nix/store/s45jal5pc0aas1hbw1k3cz3z91kvj6rv-man-paths.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pzlchxkkd17p7v6f778xwg3az9zvkrvz-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5ysj50k6dr5i9nawsz5l6a8j0rnmdda3-xdg-desktop-portal-hyprland-1.3.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c1cs3nbbzjvr3cn0xb6kq4vlqph7gzaf-nixos-system-nixos-24.11.20240527.9ca3f64.drv' failed to build

And I am lost again. :frowning:

1 Like

In cases like this where the derivation changes too much, it’s probably best to pin nixpkgs to a specific commit.

For example, if we want to pin hyprland and all its dependencies to a 0.39.1, we’d look for the last commit before it was updated to 0.40.0, which if we look at the commit history for hyprland is fbde1e7188f45e481368b69f57d805ef2c630cdc.

Next, you need to fork the nixpkgs repo and clone that in your machine. We can then create a branch of this commit and push that to your fork.

$ git clone https://github.com/<your username>/nixpkgs
$ git branch hyprland-0.39.1 fbde1e7188f45e481368b69f57d805ef2c630cdc
$ git push --set-upstream origin hyprland-0.39.1

To use packages from this branch, we need to add it as a flake input:

# flake.nix
  inputs = {
    nixpkgs-hyprland.url = "github:<your username>/nixpkgs/hyprland-0.39.1";
  };

To access this input from your configuration, you must add specialArgs to your nixosConfigurations:

{
  inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
  inputs.home-manager.url = github:nix-community/home-manager;

  outputs = { self, nixpkgs, ... }@inputs: {
    nixosConfigurations.fnord = nixpkgs.lib.nixosSystem {
+     specialArgs = { inherit inputs; };
      modules = [ ./configuration.nix ];
    };
  };
}

Finally, we can inherit all the packages that we need from this input using an overlay:

{ inputs, ... }:
{
  nixpkgs.overlays = [
    (
      final: prev:
      let
        nixpkgs-hyprland = inputs.nixpkgs-hyprland.legacyPackages.${prev.system};
      in
      {
        inherit (nixpkgs-hyprland) hyprland hyprpaper ... ;
      }
    )
  ];
}

You don’t have to pin hyprland to 0.39.1, by the way, as you can specify any nixpkgs commit. For example the one you had in your system before you updated or the hyprland update commit.

As such, you don’t really have to overlay the packages anymore (although you could if you want) as you can just modify the derivations from your nixpkgs fork (for example for the cursor fix).

This gives you more flexibility when customizing the packages as you can add changes to your system before they’re in nixpkgs without risking them breaking every time upstream is updated.

Hope this been helpful. If you have any more questions, don’t hesitate to ask :grin:

1 Like