Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vimPlugins.magenta-nvim: init at 2025-01-24 #376542

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

david-r-cox
Copy link
Member

@david-r-cox david-r-cox commented Jan 24, 2025

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@david-r-cox david-r-cox changed the title vimPlugins.magenta.nvim: init at 2025-01-24 vimPlugins.magenta-nvim: init at 2025-01-24 Jan 24, 2025
@david-r-cox david-r-cox marked this pull request as draft January 24, 2025 23:53
@david-r-cox
Copy link
Member Author

Magenta requires running npm install --frozen-lockfile during install.

I'm not yet sure how to declare this.

One idea I had was to do it within pkgs/applications/editors/vim/plugins/overrides.nix, however, this isn't as straightforward as just running npm install in buildPhase because there's no network access during the build (for purity).

Another idea is to do something similar to what's done in markdown-preview-nvim but with npm instead of yarn:

  markdown-preview-nvim =
    let
      # We only need its dependencies `node-modules`.
      nodeDep = mkYarnModules rec {
        inherit (super.markdown-preview-nvim) pname version;
        packageJSON = ./markdown-preview-nvim/package.json;
        yarnLock = "${super.markdown-preview-nvim.src}/yarn.lock";
        offlineCache = fetchYarnDeps {
          inherit yarnLock;
          hash = "sha256-kzc9jm6d9PJ07yiWfIOwqxOTAAydTpaLXVK6sEWM8gg=";
        };
      };
    in
    super.markdown-preview-nvim.overrideAttrs {
      patches = [
        (replaceVars ./markdown-preview-nvim/fix-node-paths.patch {
          node = "${nodejs}/bin/node";
        })
      ];
      postInstall = ''
        ln -s ${nodeDep}/node_modules $out/app
      '';

      nativeBuildInputs = [ nodejs ];
      doInstallCheck = true;
      installCheckPhase = ''
        node $out/app/index.js --version
      '';
    };

There doesn't seem to be a npm equivalent to mkYarnModules though and AFIK there isn't a way to do this cleanly with node2nix.

Open to ideas.

@david-r-cox
Copy link
Member Author

Not sure how all 7 of you got tagged as reviewers... apologies.

@PerchunPak
Copy link
Member

You are looking for fetchNpmDeps, no?

Not sure how all 7 of you got tagged as reviewers... apologies.

That's okay. Otherwise, we wouldn't know this PR existed

@GaetanLepage
Copy link
Contributor

Not sure how all 7 of you got tagged as reviewers... apologies.

This is normal and expected. The whole neovim team gets pinged when a PR edits specific files such as the plugin derivations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants