commit
9586378845
67
flake.lock
67
flake.lock
|
@ -2,15 +2,19 @@
|
|||
"nodes": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654858401,
|
||||
"narHash": "sha256-53bw34DtVJ2bnF6WEwy6Tym+qY0pNEiEwARUlvmTZjs=",
|
||||
"lastModified": 1667210711,
|
||||
"narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "f55e05c6d3bbe9acc7363bc8fc739518b2f02976",
|
||||
"rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -22,11 +26,11 @@
|
|||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1650374568,
|
||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||
"lastModified": 1668681692,
|
||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -37,26 +41,11 @@
|
|||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1642700792,
|
||||
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -67,27 +56,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1643381941,
|
||||
"narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1655400192,
|
||||
"narHash": "sha256-49OBVVRgb9H/PSmNT9W61+NRdDbuSJVuDDflwXlaUKU=",
|
||||
"lastModified": 1670332253,
|
||||
"narHash": "sha256-O5SmhlIUt1s+vK4NXeGYqwcBIMwbBPAEZ3GHE3XT28c=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3d7435c638baffaa826b85459df0fff47f12317d",
|
||||
"rev": "1c9ffcf70786f0966982ce0fc76ec05df2e1dec2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -101,8 +74,8 @@
|
|||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
10
flake.nix
10
flake.nix
|
@ -6,7 +6,11 @@
|
|||
|
||||
# dev
|
||||
inputs = {
|
||||
devshell.url = "github:numtide/devshell";
|
||||
devshell = {
|
||||
url = "github:numtide/devshell";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
|
@ -26,6 +30,9 @@
|
|||
}
|
||||
// flake-utils.lib.eachSystem [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
]
|
||||
(
|
||||
system: let
|
||||
|
@ -49,6 +56,7 @@
|
|||
output = "bundled.js";
|
||||
entrypoint = "./mod.ts";
|
||||
importMap = "./import_map.json";
|
||||
minify = true;
|
||||
};
|
||||
packages.bundled-wrapper = deno2nix.mkBundledWrapper {
|
||||
pname = "example-bundled-wrapper";
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
{
|
||||
"version": "2",
|
||||
"remote": {
|
||||
"https://deno.land/std@0.118.0/fmt/colors.ts": "8368ddf2d48dfe413ffd04cdbb7ae6a1009cf0dccc9c7ff1d76259d9c61a0621"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ in {
|
|||
}
|
||||
]
|
||||
)
|
||||
(importJSON lockfile)
|
||||
(importJSON lockfile).remote
|
||||
))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
src,
|
||||
lockfile,
|
||||
output ? "bundled.js",
|
||||
outPath ? "dist",
|
||||
minify ? false,
|
||||
entrypoint,
|
||||
importMap ? null,
|
||||
additionalDenoFlags ? "",
|
||||
|
@ -18,7 +20,7 @@
|
|||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version entrypoint src;
|
||||
buildInputs = with pkgs; [deno jq];
|
||||
buildInputs = with pkgs; [ deno jq nodePackages.uglify-js ];
|
||||
|
||||
buildPhase = ''
|
||||
export DENO_DIR="/tmp/deno2nix"
|
||||
|
@ -35,9 +37,18 @@ in
|
|||
${additionalDenoFlags} \
|
||||
"$src/${entrypoint}" \
|
||||
"${output}"
|
||||
|
||||
${
|
||||
if minify
|
||||
then ''
|
||||
mv ${output} ${output}-non-min
|
||||
uglifyjs ${output}-non-min -c -m > ${output}
|
||||
''
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/dist
|
||||
install -t $out/dist "${output}"
|
||||
mkdir -p $out/${outPath}
|
||||
install -t $out/${outPath} "${output}"
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue