mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-22 06:32:21 +03:00
feat(legacy): make translator, builder, etc.. configurable
This commit is contained in:
parent
47a1f48203
commit
41c56eb788
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
# TODO(antotocar34) make a smart enum of all available translators conditional on the given the subsystem? Is this possible?
|
# TODO(antotocar34) make a smart enum of all available translators conditional on the given the subsystem? Is this possible?
|
||||||
translator = mkOption {
|
translator = mkOption {
|
||||||
description = "Translators to use";
|
description = "Translator to use";
|
||||||
example = ["yarn-lock" "package-json"];
|
example = ["yarn-lock" "package-json"];
|
||||||
type = t.str;
|
type = t.str;
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
}: let
|
}: let
|
||||||
l = lib // builtins;
|
l = lib // builtins;
|
||||||
|
|
||||||
|
cfg = config.legacy;
|
||||||
|
|
||||||
pkgs = drv-parts.inputs.nixpkgs.legacyPackages.x86_64-linux;
|
pkgs = drv-parts.inputs.nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
|
||||||
dlib =
|
dlib =
|
||||||
@ -77,7 +79,7 @@
|
|||||||
config.pkgs = pkgs;
|
config.pkgs = pkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildersBySubsystem.rust.default = import ../../../../../src/subsystems/rust/builders/build-rust-package/default.nix {
|
buildersBySubsystem.${cfg.subsystem}.default = import (../../../../.. + "/src/subsystems/${cfg.subsystem}/builders/${cfg.builder}/default.nix") {
|
||||||
inherit lib pkgs utils;
|
inherit lib pkgs utils;
|
||||||
dlib = {};
|
dlib = {};
|
||||||
};
|
};
|
||||||
@ -86,7 +88,7 @@
|
|||||||
(l.evalModules {
|
(l.evalModules {
|
||||||
modules = [
|
modules = [
|
||||||
../../../../../src/modules/interfaces.translator/interface.nix
|
../../../../../src/modules/interfaces.translator/interface.nix
|
||||||
../../../../../src/subsystems/rust/translators/cargo-lock
|
(../../../../.. + "/src/subsystems/${cfg.subsystem}/translators/${cfg.translator}")
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit dlib;
|
inherit dlib;
|
||||||
@ -97,8 +99,8 @@
|
|||||||
tree = dlib.prepareSourceTree {source = config.mkDerivation.src;};
|
tree = dlib.prepareSourceTree {source = config.mkDerivation.src;};
|
||||||
|
|
||||||
project = {
|
project = {
|
||||||
relPath = "";
|
relPath = cfg.relPath;
|
||||||
subsystemInfo = {};
|
subsystemInfo = cfg.subsystemInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
result = translator.translate {
|
result = translator.translate {
|
||||||
|
@ -6,4 +6,31 @@
|
|||||||
l = lib // builtins;
|
l = lib // builtins;
|
||||||
t = l.types;
|
t = l.types;
|
||||||
in {
|
in {
|
||||||
|
options.legacy = {
|
||||||
|
builder = l.mkOption {
|
||||||
|
description = "Builder to use";
|
||||||
|
example = ["build-rust-package"];
|
||||||
|
type = t.str;
|
||||||
|
};
|
||||||
|
relPath = l.mkOption {
|
||||||
|
default = "";
|
||||||
|
description = "Relative path to project tree from source";
|
||||||
|
type = t.str;
|
||||||
|
};
|
||||||
|
subsystem = l.mkOption {
|
||||||
|
description = ''Name of subsystem to use. Examples: rust, python, nodejs'';
|
||||||
|
example = "nodejs";
|
||||||
|
type = t.str;
|
||||||
|
};
|
||||||
|
subsystemInfo = l.mkOption {
|
||||||
|
default = {};
|
||||||
|
description = "Translator specific arguments";
|
||||||
|
type = t.lazyAttrsOf (t.anything);
|
||||||
|
};
|
||||||
|
translator = l.mkOption {
|
||||||
|
description = "Translator to use";
|
||||||
|
example = ["yarn-lock" "package-json"];
|
||||||
|
type = t.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,22 @@
|
|||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
drv-parts.modules.drv-parts.mkDerivation
|
drv-parts.modules.drv-parts.mkDerivation
|
||||||
../../drv-parts/rust-cargo-lock-legacy
|
../../drv-parts/dream2nix-legacy
|
||||||
];
|
];
|
||||||
|
|
||||||
|
legacy = {
|
||||||
|
subsystem = "rust";
|
||||||
|
translator = "cargo-lock";
|
||||||
|
builder = "build-rust-package";
|
||||||
|
};
|
||||||
|
|
||||||
deps = {nixpkgs, ...}: {
|
deps = {nixpkgs, ...}: {
|
||||||
inherit (nixpkgs) fetchFromGitHub;
|
inherit (nixpkgs) fetchFromGitHub;
|
||||||
inherit (nixpkgs) stdenv;
|
inherit (nixpkgs) stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
# public = {
|
|
||||||
name = l.mkForce "ripgrep";
|
name = l.mkForce "ripgrep";
|
||||||
version = l.mkForce "13.0.0";
|
version = l.mkForce "13.0.0";
|
||||||
# };
|
|
||||||
|
|
||||||
mkDerivation = {
|
mkDerivation = {
|
||||||
src = config.deps.fetchFromGitHub {
|
src = config.deps.fetchFromGitHub {
|
||||||
|
Loading…
Reference in New Issue
Block a user