Add module
This commit is contained in:
@@ -1,38 +1,35 @@
|
||||
{
|
||||
self,
|
||||
pkgs,
|
||||
stdenv,
|
||||
lib,
|
||||
writers,
|
||||
writeScriptBin,
|
||||
nodejs,
|
||||
fetchurl,
|
||||
model ? "",
|
||||
model ? null,
|
||||
serverUrl ? "",
|
||||
local ? true,
|
||||
...
|
||||
}: let
|
||||
sgjpModel = fetchurl {
|
||||
url = "https://zil.ipipan.waw.pl/Concraft?action=AttachFile&do=get&target=concraft-pl-model-SGJP-20220221.gz";
|
||||
hash = "sha256-VcvdSkJwUhAgHroA0d/bH3QDjjO/2x8HqSuUvRgIN/4=";
|
||||
};
|
||||
}:
|
||||
writeScriptBin "conmorfeusz" ''
|
||||
#!/${nodejs}/bin/node
|
||||
// Passed from Nix derivation config
|
||||
const MORFEUSZ_ANALYSER_BIN="${self.packages.${stdenv.hostPlatform.system}.morfeusz}/bin/morfeusz_analyzer";
|
||||
const MORFEUSZ_GENERATOR_BIN="${self.packages.${stdenv.hostPlatform.system}.morfeusz}/bin/morfeusz_generator";
|
||||
const CONCRAFT_BIN="${self.packages.${stdenv.hostPlatform.system}.concraft-pl}/bin/concraft-pl";
|
||||
const CONCRAFT_MODEL="${
|
||||
if model != null
|
||||
then model
|
||||
else pkgs.callPackage ./concraft-sgjp-model.nix {}
|
||||
}";
|
||||
const CONCRAFT_SERVER_URL="${serverUrl}";
|
||||
const CONCRAFT_MODE="${
|
||||
if local
|
||||
then "local"
|
||||
else "remote"
|
||||
}";
|
||||
// =================================
|
||||
|
||||
targetModel =
|
||||
if model == ""
|
||||
then sgjpModel
|
||||
else model;
|
||||
in
|
||||
writers.makeScriptWriter {interpreter = "${nodejs}/bin/node";} "conmorfeusz" ''
|
||||
// Passed from Nix derivation config
|
||||
const MORFEUSZ_ANALYSER_BIN="${self.packages.${stdenv.hostPlatform.system}.morfeusz}/bin/morfeusz_analyzer";
|
||||
const MORFEUSZ_GENERATOR_BIN="${self.packages.${stdenv.hostPlatform.system}.morfeusz}/bin/morfeusz_generator";
|
||||
const CONCRAFT_BIN="${self.packages.${stdenv.hostPlatform.system}.concraft-pl}/bin/concraft-pl";
|
||||
const CONCRAFT_MODEL="${targetModel}";
|
||||
const CONCRAFT_SERVER_URL="${serverUrl}";
|
||||
const CONCRAFT_MODE="${
|
||||
if local
|
||||
then "local"
|
||||
else "remote"
|
||||
}";
|
||||
// =================================
|
||||
|
||||
${builtins.readFile ./index.js}
|
||||
''
|
||||
${builtins.readFile ./index.js}
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user