move translator cli to src/apps

This commit is contained in:
DavHau 2021-09-10 09:44:45 +02:00
parent 2ce1ddb6f3
commit 7ef59b51d5
4 changed files with 15 additions and 13 deletions

View File

@ -1,18 +1,22 @@
{
pkgs,
location,
translators,
}:
let
callPackage = pkgs.callPackage;
in
{
# translate cli
translate = callPackage ({ writeScript, }:
writeScript
"translate"
''${import ../translators { inherit pkgs; }}/bin/cli "$@"''
# the unified translator cli
translate = callPackage ({ python3, writeScript, ... }:
writeScript "cli" ''
translatorsJsonFile=${translators.translatorsJsonFile} \
${python3}/bin/python ${./translators-cli.py} "$@"
''
) {};
# install the framework to a specified location by copying the code
install = callPackage ({ writeScript, }:
writeScript
"install"

View File

@ -8,7 +8,7 @@ in
rec {
apps = callPackage ./apps { inherit location; };
apps = callPackage ./apps { inherit location translators; };
builders = callPackage ./builders {};

View File

@ -26,6 +26,8 @@ let
# Put all translator executables in a json file.
# This will allow the cli to call the translators of different build systems
# in a standardised way
# TODO: This doesn't scale as it requires all translators being built.
# Redesign this, to call the individual translators using nix run ...
translatorsJsonFile = callPackage ({ bash, lib, runCommand, ... }:
runCommand
"translators.json"
@ -47,10 +49,6 @@ let
) {};
in
# the unified translator cli
callPackage ({ python3, writeScriptBin, ... }:
writeScriptBin "cli" ''
translatorsJsonFile=${translatorsJsonFile} ${python3}/bin/python ${./cli.py} "$@"
''
) {}
{
inherit translators translatorsJsonFile;
}