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?
|
||||
translator = mkOption {
|
||||
description = "Translators to use";
|
||||
description = "Translator to use";
|
||||
example = ["yarn-lock" "package-json"];
|
||||
type = t.str;
|
||||
};
|
||||
|
@ -8,6 +8,8 @@
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
|
||||
cfg = config.legacy;
|
||||
|
||||
pkgs = drv-parts.inputs.nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
||||
dlib =
|
||||
@ -77,7 +79,7 @@
|
||||
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;
|
||||
dlib = {};
|
||||
};
|
||||
@ -86,7 +88,7 @@
|
||||
(l.evalModules {
|
||||
modules = [
|
||||
../../../../../src/modules/interfaces.translator/interface.nix
|
||||
../../../../../src/subsystems/rust/translators/cargo-lock
|
||||
(../../../../.. + "/src/subsystems/${cfg.subsystem}/translators/${cfg.translator}")
|
||||
];
|
||||
specialArgs = {
|
||||
inherit dlib;
|
||||
@ -97,8 +99,8 @@
|
||||
tree = dlib.prepareSourceTree {source = config.mkDerivation.src;};
|
||||
|
||||
project = {
|
||||
relPath = "";
|
||||
subsystemInfo = {};
|
||||
relPath = cfg.relPath;
|
||||
subsystemInfo = cfg.subsystemInfo;
|
||||
};
|
||||
|
||||
result = translator.translate {
|
||||
|
@ -6,4 +6,31 @@
|
||||
l = lib // builtins;
|
||||
t = l.types;
|
||||
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 {
|
||||
imports = [
|
||||
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, ...}: {
|
||||
inherit (nixpkgs) fetchFromGitHub;
|
||||
inherit (nixpkgs) stdenv;
|
||||
};
|
||||
|
||||
# public = {
|
||||
name = l.mkForce "ripgrep";
|
||||
version = l.mkForce "13.0.0";
|
||||
# };
|
||||
|
||||
mkDerivation = {
|
||||
src = config.deps.fetchFromGitHub {
|
||||
|
Loading…
Reference in New Issue
Block a user