nix-community / yarn2nix

Generate nix expressions from a yarn.lock file [maintainer=???]
GNU General Public License v3.0
123 stars 61 forks source link

Couldn't find a package.json file #96

Open domenkozar opened 5 years ago

domenkozar commented 5 years ago
distPhase
yarn pack v1.9.4
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
warning Skipping preferred cache folder "/homeless-shelter/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/build/.yarn-cache-1000".
error Couldn't find a package.json file in "/nix/store/z9mx9g3n0idh9jmlnhiq64ahl8qg7zdg-hercules-ci-node-packages/libexec/hercules-frontend/deps/hercules-frontend"
info Visit https://yarnpkg.com/en/docs/cli/pack for documentation about this command.
builder for '/nix/store/q839ddmz6dydx39y0iyb8ihbav3jl7am-hercules-ci-node-packages.drv' failed with exit code 1
$ ls -la /nix/store/z9mx9g3n0idh9jmlnhiq64ahl8qg7zdg-hercules-ci-node-packages/libexec/hercules-frontend/deps/hercules-frontend
total 16
drwxr-xr-x 1 nixbld1 nixbld   74 Mar 27 11:22 .
drwxr-xr-x 1 nixbld1 nixbld   34 Mar 27 11:22 ..
-rw-r--r-- 1 nixbld1 nixbld 7689 Mar 27 11:22 env-vars
lrwxrwxrwx 1 nixbld1 nixbld   22 Mar 27 11:22 hercules-frontend -> deps/hercules-frontend
lrwxrwxrwx 1 nixbld1 nixbld  111 Mar 27 11:22 node_modules -> /nix/store/l0zbr7mq890m8x36awvl8lyd3v3ba4hl-hercules-frontend-modules-0.0.1/deps/hercules-frontend/node_modules

Using

  yarnPkg = (pkgs.callPackage pkgs.sources.yarn2nix {}).mkYarnPackage {
    name = "hercules-ci-node-packages";
    packageJSON = ./package.json;
    src = null;
    unpackPhase = ":";
    yarnLock = ./yarn.lock;
    publishBinsFor = ["parcel-bundler"];
  };

So it seems packageJSON doesn't work anymore with my hack.

domenkozar commented 5 years ago

Following is a new hack:

  yarnPkg = (pkgs.callPackage pkgs.sources.yarn2nix {}).mkYarnPackage {
    name = "hercules-ci-node-packages";
    src = cleanSourceWith {
      src = ./.;
      filter = name: type: baseNameOf (toString name) == "package.json";
    };
    yarnLock = ./yarn.lock;
    publishBinsFor = ["parcel-bundler"];
  };