added test case and improved api
This commit is contained in:
@@ -908,8 +908,8 @@ Related options:
|
|||||||
|
|
||||||
: The Flags passed to `deno install`.
|
: The Flags passed to `deno install`.
|
||||||
|
|
||||||
: _Default:_ `[ "--allow-scripts" "--frozen" ]` for `buildDenoDeps`
|
|
||||||
: _Default:_ `[ "--allow-scripts" "--frozen" "--cached-only" ]` for `buildDenoPackage`
|
: _Default:_ `[ "--allow-scripts" "--frozen" "--cached-only" ]` for `buildDenoPackage`
|
||||||
|
: _Default:_ `[ "--allow-scripts" "--frozen" ]` for `buildDenoDeps` (`"--cached-only"` is filtered out)
|
||||||
|
|
||||||
#### Private registries {#javascript-buildDenoPackage-private-registries}
|
#### Private registries {#javascript-buildDenoPackage-private-registries}
|
||||||
There are currently 2 options, which enable the use of private registries in a `buildDenoPackage` derivation.
|
There are currently 2 options, which enable the use of private registries in a `buildDenoPackage` derivation.
|
||||||
@@ -1017,7 +1017,11 @@ Related options:
|
|||||||
|
|
||||||
*`denoCompileFlags`* (Array of string; optional)
|
*`denoCompileFlags`* (Array of string; optional)
|
||||||
|
|
||||||
: Flags passed to `deno compile`.
|
: Flags passed to `deno compile [denoTaskFlags] ${binaryEntrypointPath} [extraCompileFlags]`.
|
||||||
|
|
||||||
|
*`extraCompileFlags`* (Array of string; optional)
|
||||||
|
|
||||||
|
: Flags passed to `deno compile [denoTaskFlags] ${binaryEntrypointPath} [extraCompileFlags]`.
|
||||||
|
|
||||||
*`binaryEntrypointPath`* (String or null; optional)
|
*`binaryEntrypointPath`* (String or null; optional)
|
||||||
|
|
||||||
@@ -1093,7 +1097,11 @@ Related options:
|
|||||||
|
|
||||||
*`denoTaskFlags`* (Array of strings; optional)
|
*`denoTaskFlags`* (Array of strings; optional)
|
||||||
|
|
||||||
: The flags passed to `deno task`.
|
: The flags passed to `deno task [denoTaskFlags] ${denoTaskScript} [extraTaskFlags]`.
|
||||||
|
|
||||||
|
*`extraTaskFlags`* (Array of strings; optional)
|
||||||
|
|
||||||
|
: The flags passed to `deno task [denoTaskFlags] ${denoTaskScript} [extraTaskFlags]`.
|
||||||
|
|
||||||
*`denoTaskPrefix`* (String; optional)
|
*`denoTaskPrefix`* (String; optional)
|
||||||
|
|
||||||
|
|||||||
@@ -65,16 +65,20 @@
|
|||||||
binaryEntrypointPath ? null,
|
binaryEntrypointPath ? null,
|
||||||
# Flags to pass to all deno commands.
|
# Flags to pass to all deno commands.
|
||||||
denoFlags ? [ ],
|
denoFlags ? [ ],
|
||||||
# Flags to pass to `deno task ${denoTaskScript}`.
|
# Flags to pass to `deno task [denoTaskFlags] ${denoTaskScript}`.
|
||||||
denoTaskFlags ? [ ],
|
denoTaskFlags ? [ ],
|
||||||
# Flags to pass to `deno compile`.
|
# Flags to pass to `deno compile [denoTaskFlags] ${binaryEntrypointPath}`.
|
||||||
denoCompileFlags ? [ ],
|
denoCompileFlags ? [ ],
|
||||||
# Flags to pass to `deno install`.
|
# Flags to pass to `deno install [denoInstallFlags]`.
|
||||||
denoInstallFlags ? [
|
denoInstallFlags ? [
|
||||||
"--allow-scripts"
|
"--allow-scripts"
|
||||||
"--frozen"
|
"--frozen"
|
||||||
"--cached-only"
|
"--cached-only"
|
||||||
],
|
],
|
||||||
|
# Flags to pass to `deno task [denoTaskFlags] ${denoTaskScript} [extraTaskFlags]`.
|
||||||
|
extraTaskFlags ? [ ],
|
||||||
|
# Flags to pass to `deno compile [denoTaskFlags] ${binaryEntrypointPath} [extraCompileFlags]`.
|
||||||
|
extraCompileFlags ? [ ],
|
||||||
nativeBuildInputs ? [ ],
|
nativeBuildInputs ? [ ],
|
||||||
dontFixup ? true,
|
dontFixup ? true,
|
||||||
# Custom denoConfigHook
|
# Custom denoConfigHook
|
||||||
@@ -98,6 +102,8 @@ let
|
|||||||
denoTaskFlags_ = builtins.concatStringsSep " " denoTaskFlags;
|
denoTaskFlags_ = builtins.concatStringsSep " " denoTaskFlags;
|
||||||
denoCompileFlags_ = builtins.concatStringsSep " " denoCompileFlags;
|
denoCompileFlags_ = builtins.concatStringsSep " " denoCompileFlags;
|
||||||
denoInstallFlags_ = builtins.concatStringsSep " " denoInstallFlags;
|
denoInstallFlags_ = builtins.concatStringsSep " " denoInstallFlags;
|
||||||
|
extraTaskFlags_ = builtins.concatStringsSep " " extraTaskFlags;
|
||||||
|
extraCompileFlags_ = builtins.concatStringsSep " " extraCompileFlags;
|
||||||
|
|
||||||
args' = builtins.removeAttrs args [ "denoDepsInjectedEnvVars" ];
|
args' = builtins.removeAttrs args [ "denoDepsInjectedEnvVars" ];
|
||||||
|
|
||||||
@@ -133,6 +139,8 @@ stdenvNoCC.mkDerivation (
|
|||||||
denoTaskFlags_
|
denoTaskFlags_
|
||||||
denoCompileFlags_
|
denoCompileFlags_
|
||||||
denoInstallFlags_
|
denoInstallFlags_
|
||||||
|
extraTaskFlags_
|
||||||
|
extraCompileFlags_
|
||||||
binaryEntrypointPath
|
binaryEntrypointPath
|
||||||
hostPlatform_
|
hostPlatform_
|
||||||
denoWorkspacePath
|
denoWorkspacePath
|
||||||
|
|||||||
@@ -16,12 +16,20 @@ denoBuildHook() {
|
|||||||
deno compile \
|
deno compile \
|
||||||
--output "$package_name" \
|
--output "$package_name" \
|
||||||
--target "$hostPlatform_" \
|
--target "$hostPlatform_" \
|
||||||
"${denoWorkspacePath+$denoWorkspacePath/}$binaryEntrypointPath" \
|
|
||||||
$denoCompileFlags \
|
$denoCompileFlags \
|
||||||
$denoFlags
|
$denoFlags \
|
||||||
|
"${denoWorkspacePath+$denoWorkspacePath/}$binaryEntrypointPath"
|
||||||
|
$extraCompileFlags \
|
||||||
|
|
||||||
elif [ -n "${denoTaskScript-}" ]; then
|
elif [ -n "${denoTaskScript-}" ]; then
|
||||||
if ! @denoTaskPrefix@ deno task ${denoWorkspacePath+--cwd=$denoWorkspacePath} "$denoTaskScript" $denoTaskFlags $denoFlags @denoTaskSuffix@; then
|
if ! @denoTaskPrefix@ \
|
||||||
|
deno task \
|
||||||
|
${denoWorkspacePath+--cwd=$denoWorkspacePath} \
|
||||||
|
$denoTaskFlags \
|
||||||
|
$denoFlags \
|
||||||
|
"$denoTaskScript" \
|
||||||
|
$extraTaskFlags \
|
||||||
|
@denoTaskSuffix@; then
|
||||||
echo
|
echo
|
||||||
echo 'ERROR: `deno task` failed'
|
echo 'ERROR: `deno task` failed'
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -12,5 +12,6 @@
|
|||||||
inherit (pkgs.callPackage ./external { })
|
inherit (pkgs.callPackage ./external { })
|
||||||
readma-cli-linux
|
readma-cli-linux
|
||||||
fresh-init-cli-linux
|
fresh-init-cli-linux
|
||||||
|
invidious-companion-cli-linux
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,4 +27,34 @@
|
|||||||
binaryEntrypointPath = "./src/mod.ts";
|
binaryEntrypointPath = "./src/mod.ts";
|
||||||
targetSystem = "x86_64-linux";
|
targetSystem = "x86_64-linux";
|
||||||
};
|
};
|
||||||
|
invidious-companion-cli-linux = buildDenoPackage {
|
||||||
|
pname = "invidious-companion-cli";
|
||||||
|
version = "";
|
||||||
|
denoDepsHash = "sha256-z78m/Na2jvUARi4cTQvtFnD6iF7YX9Vzh2D6DBSj/HA=";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "iv-org";
|
||||||
|
repo = "invidious-companion";
|
||||||
|
rev = "a34c27ff63e51f9e3adc0e8647cd12382f8f1ffe";
|
||||||
|
hash = "sha256-/S8F7G8li12k0objsdFuh+mle6p2mk8zNUUCrG9hgns=";
|
||||||
|
};
|
||||||
|
binaryEntrypointPath = "src/main.ts";
|
||||||
|
denoCompileFlags = [
|
||||||
|
"--include=./src/lib/helpers/youtubePlayerReq.ts"
|
||||||
|
"--include=./src/lib/helpers/getFetchClient.ts"
|
||||||
|
"--allow-import=github.com:443,jsr.io:443,cdn.jsdelivr.net:443,esm.sh:443,deno.land:443"
|
||||||
|
"--allow-net"
|
||||||
|
"--allow-env"
|
||||||
|
"--allow-read"
|
||||||
|
"--allow-sys=hostname"
|
||||||
|
"--allow-write=/var/tmp/youtubei.js"
|
||||||
|
];
|
||||||
|
denoInstallFlags = [
|
||||||
|
"--allow-scripts"
|
||||||
|
"--frozen"
|
||||||
|
"--cached-only"
|
||||||
|
"--entrypoint"
|
||||||
|
"src/main.ts"
|
||||||
|
];
|
||||||
|
targetSystem = "x86_64-linux";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ rec {
|
|||||||
denoDepsHash = "sha256-Qvn3g+2NeWpNCfmfqXtPcJU4+LwrOSh1nq51xAbZZhk=";
|
denoDepsHash = "sha256-Qvn3g+2NeWpNCfmfqXtPcJU4+LwrOSh1nq51xAbZZhk=";
|
||||||
src = nix-gitignore.gitignoreSource [ ] ./.;
|
src = nix-gitignore.gitignoreSource [ ] ./.;
|
||||||
denoWorkspacePath = "./sub1";
|
denoWorkspacePath = "./sub1";
|
||||||
denoTaskFlags = [
|
extraTaskFlags = [
|
||||||
"--text"
|
"--text"
|
||||||
"sub1"
|
"sub1"
|
||||||
];
|
];
|
||||||
denoTaskSuffix = ">out.txt";
|
denoTaskSuffix = ">out.txt";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cp out.txt $out
|
cp out.txt $out
|
||||||
'';
|
'';
|
||||||
@@ -20,7 +21,7 @@ rec {
|
|||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
inherit (sub1) denoDeps src;
|
inherit (sub1) denoDeps src;
|
||||||
denoWorkspacePath = "./sub2";
|
denoWorkspacePath = "./sub2";
|
||||||
denoTaskFlags = [
|
extraTaskFlags = [
|
||||||
"--text"
|
"--text"
|
||||||
"sub2"
|
"sub2"
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user