Giter VIP home page Giter VIP logo

Comments (6)

willruggiano avatar willruggiano commented on June 26, 2024 1

I see. Unfortunately I do not have a macOS to try and repro on my own.

From what you've described, I am suspicious of the dependencies for which we are overriding derivation inputs. If you have time and are so inclined, could you try commenting out the overridden dependencies here (around L50); https://github.com/nix-community/neovim-nightly-overlay/blob/master/flake/packages/neovim.nix

Let me know if you need help forking/cloning this repo and/or getting your neovim flake to point at your local copy.

from neovim-nightly-overlay.

willruggiano avatar willruggiano commented on June 26, 2024

So, immediately upon opening neovim your cpu's pegged? Are there any clues in :checkhealth? What about Activity Monitor, any clues in there or does it just claim "neovim" is the culprit?

from neovim-nightly-overlay.

konradmalik avatar konradmalik commented on June 26, 2024

Not immediately after opening. Only after opening any file, or after opening file preview via telescope. That's why the first thing that came to my mind was treesitter but not sure how to check that.

Activity monitor just shows "nvim - 99.9" in the cpu column and laptop gets hot.

Checkhealth shows nothing suspicious but I'll post both reports later (compiled and binary from neovim repo), maybe it'll show some differences, because one works ok, the other not.

from neovim-nightly-overlay.

konradmalik avatar konradmalik commented on June 26, 2024

Thanks for a good lead!
After trial and error, the cause seems to be: libuv (after commenting it out in overrides, nvim compiled from this repo behaves normally).
Here's a workaround that fixes the issue in my flake: konradmalik/neovim-flake@3d71a41

But I'm not sure how we should proceed in this repo to fix it. Any suggestions?
What's weird is that both nixpkgs and neovim deps.txt file seem to have the same libuv version (1.48), but they still behave differently on darwin.

from neovim-nightly-overlay.

willruggiano avatar willruggiano commented on June 26, 2024

Interesting! Although not totally surprising. You said the binary release (or build) for the same upstream commit does not exhibit this cpu problem? I guess we need to go dig through neovim's cmake code :D

Anyways, thanks for filing this issue! I can take it from here. Will commit a temporary fix until I have time to investigate what could be the real root cause here.

from neovim-nightly-overlay.

konradmalik avatar konradmalik commented on June 26, 2024

Hmm, so this works properly (current nixpkgs):

            libuv = pkgs.libuv.overrideAttrs {
              src = pkgs.fetchFromGitHub {
                owner = "libuv";
                repo = "libuv";
                rev = "v1.48.0";
                hash = "sha256-U68BmIQNpmIy3prS7LkYl+wvDJQNikoeFiKh50yQFoA=";
              };
            };

While this does not (neovim's deps.txt):

            libuv = pkgs.libuv.overrideAttrs {
              src = pkgs.fetchurl {
                url = "https://github.com/libuv/libuv/archive/v1.48.0.tar.gz";
                sha256 = "8c253adb0f800926a6cbd1c6576abae0bc8eb86a4f891049b72f9e5b7dc58f33";
              };
            };

I know the above is the same what we concluded earlier, but seems more clear to show this explicitly.

Does it mean that v1.48.0 used in nixpkgs (downloaded from source directly) is not the same as v1.48.0 locked in neovim's repo (downloaded from the released tarball)?
Edit1: nope, downloaded both, diffed, and they're the same except for the .git folder.

And then, I still cannot understand why a pre-built binary from neovim works fine...

Edit2: the below also works (!); seems like something's fishy in fetchurl on darwin?

            libuv = pkgs.libuv.overrideAttrs {
              src = pkgs.fetchzip {
                url = "https://github.com/libuv/libuv/archive/v1.48.0.tar.gz";
                hash = "sha256-U68BmIQNpmIy3prS7LkYl+wvDJQNikoeFiKh50yQFoA=";
              };
            };

Edit3: I've built libuv using both fetchzip and fetchurl, then used nix-diff to compare both packages. Attaching nix-diff.txt (it's quite long).
I've never used that tool and not sure how to interpret the results and how good they're, but at first sight looks like a lot of differences that I didn't expect (even 24.11 vs 24.05).

Edit4: included fetchTarball into the equation:

  • pkgs.fetchzip - works
  • pkgs.fetchFromGithub - works
  • builtins.fetchTarball - has CPU problem
  • builtins.fetchurl - has CPU problem

For the interested a branch where there's 3 libuvs defined for easy testing: https://github.com/konradmalik/neovim-flake/tree/darwin-fix

If this matters, my nix version: 2.22.1

Edit5:
comparing files produced by two derivations as follows shows no differences, but still libuv built with fetchurl vs fetchzip behaves differently

        libuv-fetchurl = pkgs.stdenv.mkDerivation {
          name = "libuv-fetchurl";
          src = builtins.fetchurl {
            url = "https://github.com/libuv/libuv/archive/v1.48.0.tar.gz";
            sha256 = "8c253adb0f800926a6cbd1c6576abae0bc8eb86a4f891049b72f9e5b7dc58f33";
          };
          installPhase = ''
            cp -r ./ $out/
          '';
        };
        libuv-fetchzip = pkgs.stdenv.mkDerivation {
          name = "libuv-fetchzip";
          src = pkgs.fetchzip {
            url = "https://github.com/libuv/libuv/archive/v1.48.0.tar.gz";
            hash = "sha256-U68BmIQNpmIy3prS7LkYl+wvDJQNikoeFiKh50yQFoA=";
          };
          installPhase = ''
            cp -r ./ $out/
          '';
        };

from neovim-nightly-overlay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.