mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-30 10:07:33 +03:00
feat(nodejs-devshell): expose node_modules drv submodule
This commit is contained in:
parent
299c087847
commit
e34c4fb33e
@ -2,29 +2,27 @@
|
||||
config,
|
||||
lib,
|
||||
dream2nix,
|
||||
packageSets,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
|
||||
cfg = config.nodejs-devshell;
|
||||
|
||||
nodeModulesDrv = dream2nix.lib.evalModules {
|
||||
inherit packageSets;
|
||||
modules = [
|
||||
dream2nix.modules.drv-parts.nodejs-node-modules
|
||||
nodeModulesDir = "${cfg.nodeModules.public}/lib/node_modules/${config.name}/node_modules";
|
||||
in {
|
||||
imports = [
|
||||
./interface.nix
|
||||
dream2nix.modules.drv-parts.mkDerivation
|
||||
dream2nix.modules.drv-parts.nodejs-package-lock
|
||||
];
|
||||
|
||||
nodejs-devshell.nodeModules = {
|
||||
imports = [
|
||||
{inherit (config) nodejs-package-lock name version;}
|
||||
{mkDerivation.src = l.mkForce null;}
|
||||
];
|
||||
};
|
||||
|
||||
nodeModulesDir = "${nodeModulesDrv}/lib/node_modules/${config.name}/node_modules";
|
||||
in {
|
||||
imports = [
|
||||
dream2nix.modules.drv-parts.mkDerivation
|
||||
dream2nix.modules.drv-parts.nodejs-package-lock
|
||||
];
|
||||
|
||||
# rsync the node_modules folder
|
||||
# - tracks node-modules store path via .dream2nix/.node_modules_id
|
||||
# - omits copying if store path did not change
|
||||
|
23
v1/nix/modules/drv-parts/nodejs-devshell/interface.nix
Normal file
23
v1/nix/modules/drv-parts/nodejs-devshell/interface.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
dream2nix,
|
||||
packageSets,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
t = l.types;
|
||||
in {
|
||||
options.nodejs-devshell = {
|
||||
nodeModules = l.mkOption {
|
||||
description = "drv-parts module for the node_modules derivation";
|
||||
type = t.submoduleWith {
|
||||
specialArgs = {inherit packageSets dream2nix;};
|
||||
modules = [
|
||||
dream2nix.modules.drv-parts.core
|
||||
dream2nix.modules.drv-parts.nodejs-node-modules
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user