Allow overriding src
This commit is contained in:
@@ -23,8 +23,18 @@ to be customized, for example:
|
|||||||
let
|
let
|
||||||
|
|
||||||
project = pkgs.callPackage ./yarn-project.nix {
|
project = pkgs.callPackage ./yarn-project.nix {
|
||||||
|
|
||||||
|
# Example of providing a different source.
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "johndoe";
|
||||||
|
repo = "myproject";
|
||||||
|
rev = "v1.0.0";
|
||||||
|
sha256 = "1hdhafj726g45gh7nj8qv1xls8mps3vhzq3aasdymbdqcb1clhkz";
|
||||||
|
};
|
||||||
|
|
||||||
# Example of selecting a specific version of Node.js.
|
# Example of selecting a specific version of Node.js.
|
||||||
nodejs = pkgs.nodejs-14_x;
|
nodejs = pkgs.nodejs-14_x;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in project.overrideAttrs (oldAttrs: {
|
in project.overrideAttrs (oldAttrs: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# This file is generated by running "yarn install" inside your project.
|
# This file is generated by running "yarn install" inside your project.
|
||||||
# Manual changes might be lost - proceed with caution!
|
# Manual changes might be lost - proceed with caution!
|
||||||
|
|
||||||
{ lib, bash, coreutils, nodejs, perl, stdenv, writeText }:
|
{ lib, coreutils, nodejs, stdenv, src ? ./. }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
@@ -23,9 +23,9 @@ let
|
|||||||
|
|
||||||
# Directory of just the files needed to run Yarn.
|
# Directory of just the files needed to run Yarn.
|
||||||
yarn-closure = cleanSourceWith {
|
yarn-closure = cleanSourceWith {
|
||||||
src = ./.;
|
inherit src;
|
||||||
filter = let
|
filter = let
|
||||||
srcStr = toString ./.;
|
srcStr = toString src;
|
||||||
srcRel = removePrefix "${srcStr}/";
|
srcRel = removePrefix "${srcStr}/";
|
||||||
in path: type:
|
in path: type:
|
||||||
elem "${type}:${srcRel path}" yarn-closure-entries;
|
elem "${type}:${srcRel path}" yarn-closure-entries;
|
||||||
@@ -71,7 +71,7 @@ let
|
|||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = project-name;
|
name = project-name;
|
||||||
src = ./.;
|
inherit src;
|
||||||
|
|
||||||
# Tell node-gyp to use the provided Node.js headers for native code builds.
|
# Tell node-gyp to use the provided Node.js headers for native code builds.
|
||||||
npm_config_nodedir = nodejs;
|
npm_config_nodedir = nodejs;
|
||||||
|
|||||||
Reference in New Issue
Block a user