mirror of
https://github.com/nix-community/dream2nix.git
synced 2025-01-03 11:56:36 +03:00
nodejs-granular: allow overrides for specific and all nodejsDeps
This commit is contained in:
parent
69ce9f24c0
commit
89feb64c5c
@ -71,18 +71,23 @@
|
||||
|
||||
nodejsDeps =
|
||||
lib.mapAttrs
|
||||
(name: versions:
|
||||
(
|
||||
name: versions:
|
||||
lib.genAttrs
|
||||
versions
|
||||
(version:
|
||||
makeDependencyModule name version))
|
||||
(version: {...}: {
|
||||
imports = [
|
||||
(commonModule name version)
|
||||
(makeDependencyModule name version)
|
||||
cfg.overrideAll
|
||||
(cfg.overrides.${name} or {})
|
||||
];
|
||||
})
|
||||
)
|
||||
packageVersions;
|
||||
|
||||
# Generates a derivation for a specific package name + version
|
||||
makeDependencyModule = name: version: {config, ...}: {
|
||||
imports = [
|
||||
(commonModule name version)
|
||||
];
|
||||
name = lib.replaceStrings ["@" "/"] ["__at__" "__slash__"] name;
|
||||
inherit version;
|
||||
env = {
|
||||
|
@ -7,8 +7,21 @@
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
t = l.types;
|
||||
cfg = config.nodejs-granular;
|
||||
mkSubmodule = import ../../../lib/internal/mkSubmodule.nix {inherit lib specialArgs;};
|
||||
in {
|
||||
options.nodejs-granular = l.mapAttrs (_: l.mkOption) {
|
||||
options.nodejs-granular = mkSubmodule {
|
||||
imports = [
|
||||
../overrides
|
||||
];
|
||||
config.overrideType = {
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.mkDerivation
|
||||
dream2nix.modules.dream2nix.core
|
||||
];
|
||||
};
|
||||
|
||||
options = l.mapAttrs (_: l.mkOption) {
|
||||
buildScript = {
|
||||
type = t.nullOr (t.oneOf [t.str t.path t.package]);
|
||||
description = ''
|
||||
@ -36,11 +49,11 @@ in {
|
||||
deps = {
|
||||
type = t.lazyAttrsOf (t.lazyAttrsOf (t.submoduleWith {
|
||||
modules = [
|
||||
dream2nix.modules.dream2nix.core
|
||||
dream2nix.modules.dream2nix.mkDerivation
|
||||
cfg.overrideType
|
||||
];
|
||||
inherit specialArgs;
|
||||
}));
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user