feature: handle git dependencies
- add git and cacert as deps to cacheDrvs - use pkg.reference instead of version in package.json of isolated builds since it allow yarn to find the git repo (this will probably also fix oter type of deps)
This commit is contained in:
@@ -245,6 +245,7 @@ export default async (project: Project, cache: Cache, report: Report) => {
|
||||
`${isolatedProp} = optionalOverride (args.${overrideArg} or null) (mkIsolatedBuild { ${[
|
||||
`pname = ${json(pkg.name)};`,
|
||||
`version = ${json(pkg.version)};`,
|
||||
`reference = ${json(pkg.reference)};`,
|
||||
`locators = [\n${locators}];`,
|
||||
].join(` `)} });`
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This file is generated by running "yarn install" inside your project.
|
||||
# Manual changes might be lost - proceed with caution!
|
||||
|
||||
{ lib, nodejs, stdenv, fetchurl, writeText }:
|
||||
{ lib, nodejs, stdenv, fetchurl, writeText, git, cacert }:
|
||||
{ src, overrideAttrs ? null, ... } @ args:
|
||||
|
||||
let
|
||||
@@ -43,7 +43,7 @@ let
|
||||
in lib.mapAttrs (locator: { filename, sha512 }: stdenv.mkDerivation {
|
||||
inherit src builder locator;
|
||||
name = lib.strings.sanitizeDerivationName locator;
|
||||
buildInputs = [ nodejs ];
|
||||
buildInputs = [ nodejs git cacert ];
|
||||
outputFilename = filename;
|
||||
outputHashMode = "flat";
|
||||
outputHashAlgo = "sha512";
|
||||
@@ -64,7 +64,7 @@ let
|
||||
mkCacheBuilderForDrvs (pickCacheDrvs locators);
|
||||
|
||||
# Create a derivation that builds a node-pre-gyp module in isolation.
|
||||
mkIsolatedBuild = { pname, version, locators }: stdenv.mkDerivation (drvCommon // {
|
||||
mkIsolatedBuild = { pname, version, reference, locators }: stdenv.mkDerivation (drvCommon // {
|
||||
inherit pname version;
|
||||
phases = [ "buildPhase" "installPhase" ];
|
||||
|
||||
@@ -74,7 +74,7 @@ let
|
||||
source ${mkCacheBuilderForLocators locators}
|
||||
popd > /dev/null
|
||||
|
||||
echo '{ "dependencies": { "${pname}": "${version}" } }' > package.json
|
||||
echo '{ "dependencies": { "${pname}": "${reference}" } }' > package.json
|
||||
install -m 0600 ${lockfile} ./yarn.lock
|
||||
export yarn_global_folder="$TMP"
|
||||
export YARN_ENABLE_IMMUTABLE_INSTALLS=false
|
||||
|
||||
Reference in New Issue
Block a user