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

yarn github dependencies not working #7

Open
yorickvP opened this issue Aug 9, 2019 · 0 comments
Open

yarn github dependencies not working #7

yorickvP opened this issue Aug 9, 2019 · 0 comments

Comments

@yorickvP
Copy link
Contributor

yorickvP commented Aug 9, 2019

Example: current vault ui.
The lockfile has blocks like

ember-cli-sri@meirish/ember-cli-sri#rooturl:
  version "2.1.0"
  resolved "https://codeload.github.com/meirish/ember-cli-sri/tar.gz/1c0ff776a61f09121d1ea69ce16e4653da5e1efa"
  dependencies:
    broccoli-sri-hash "^2.1.0"

This is the git hash, not the sha1. Our mkyarnjson returns AssertionError [ERR_ASSERTION]: missing integrity with it. This is why the CI fails.

aszlig added a commit to aszlig/nix-npm-buildpackage that referenced this issue Dec 10, 2020
This is similar to b5cd694, which added
the attribute to mkNodeModule and buildNpmPackage but didn't do it for
the buildYarnPackage flavour.

However, we're using lib.extends instead of a plain attribute set, since
we want to tread the original package set as a fixed point to be
compasable with multiple levels of overrides, similar to how it's done
with nixpkgs overlays.

In my case it's to quickly override a dependency fetched from GitHub,
eg. like this:

  let
    mydep = "https://github.com/someowner/somerepo.git";

    newMydep = pkgs.fetchFromGitHub {
      owner = "someowner";
      repo = "somerepo";
      rev = "...";
      sha256 = "...";
      fetchSubmodules = true;
      leaveDotGit = true;
    };

  in buildYarnPackage {
    # ...
    nativeBuildInputs = lib.singleton (pkgs.writeScriptBin "git" ''
      #!${pkgs.python3.interpreter}
      import sys, os
      for n, arg in enumerate(sys.argv):
        if arg == '${mydep}':
          sys.argv[n] = '${newMydep}'
      os.execv('${pkgs.git}/bin/git', sys.argv)
    '');
    packageOverrides = lib.singleton (self: super: {
      ${mydep} = super.${mydep} // { path = "dummy"; };
    });
    # ...
  }

I know that the way I've done the above is probably winning the first
price for "the ugliest override" but since I'm not particularly invested
in anything related to node.js, I'm usually pretty cruel when it comes
to it.

So the above example is just to have a complete almost-real-world
example for reference and in this case it's to work around serokell#7.

Signed-off-by: aszlig <aszlig@nix.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant