From 5a7373d0108ef978be7914eae772199ad5e69eba Mon Sep 17 00:00:00 2001 From: Seungheon Oh Date: Fri, 17 Mar 2023 18:22:09 -0500 Subject: [PATCH] Support npm submodules --- nix/default.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nix/default.nix b/nix/default.nix index 9d364cef1..94c9fc4c2 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -20,6 +20,8 @@ , spagoPackages ? "${src}/spago-packages.nix" # Configuration that will be used to generate a `devShell` for the project , shell ? { } + # Path to submodule locations that needs to be copied when making node env +, submodules ? [ ] , ... }: let @@ -36,8 +38,15 @@ let } '' mkdir $out cd $out - cp ${packageLock} ./package-lock.json - cp ${packageJson} ./package.json + ${builtins.concatStringsSep "\n" + (builtins.map + (modulePath: + "cp ${modulePath} ./${builtins.baseNameOf (builtins.toString modulePath)} -r") + submodules + ) + } + cp ${packageLock} ./package-lock.json -f + cp ${packageJson} ./package.json -f node2nix ${pkgs.lib.optionalString withDevDeps "--development" } \ --lock ./package-lock.json -i ./package.json '')