2022-06-19 01:24:56 +00:00
|
|
|
{
|
2022-09-09 14:36:35 +00:00
|
|
|
# main
|
2022-06-19 01:24:56 +00:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2022-09-09 14:36:35 +00:00
|
|
|
};
|
2022-06-19 01:24:56 +00:00
|
|
|
|
2022-09-09 14:36:35 +00:00
|
|
|
# dev
|
|
|
|
inputs = {
|
2022-12-09 04:42:01 +00:00
|
|
|
devshell = {
|
|
|
|
url = "github:numtide/devshell";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
};
|
2022-09-09 14:36:35 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2022-06-19 01:24:56 +00:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
2022-09-09 14:36:35 +00:00
|
|
|
|
2022-06-19 01:24:56 +00:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
flake-utils,
|
|
|
|
...
|
|
|
|
} @ inputs:
|
2022-08-03 23:28:28 +00:00
|
|
|
{
|
2022-09-09 14:36:35 +00:00
|
|
|
overlays.default = import ./nix/overlay.nix;
|
2022-08-03 23:28:28 +00:00
|
|
|
overlay = self.overlays.default;
|
2022-06-19 01:42:24 +00:00
|
|
|
}
|
|
|
|
// flake-utils.lib.eachSystem [
|
2022-06-19 01:24:56 +00:00
|
|
|
"x86_64-linux"
|
2022-12-09 04:38:45 +00:00
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"aarch64-darwin"
|
2022-06-19 01:24:56 +00:00
|
|
|
]
|
|
|
|
(
|
|
|
|
system: let
|
2022-09-09 14:36:35 +00:00
|
|
|
inherit (pkgs) deno2nix;
|
2022-06-19 01:24:56 +00:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2022-09-09 14:36:35 +00:00
|
|
|
overlays = with inputs; [
|
2022-08-03 23:28:28 +00:00
|
|
|
self.overlays.default
|
2022-09-09 14:36:35 +00:00
|
|
|
devshell.overlay
|
2022-06-19 01:24:56 +00:00
|
|
|
];
|
|
|
|
};
|
2022-08-03 23:28:28 +00:00
|
|
|
in {
|
2022-09-09 14:36:35 +00:00
|
|
|
packages.depslink = deno2nix.internal.mkDepsLink ./lock.json;
|
|
|
|
packages.bundled = deno2nix.mkBundled {
|
2022-09-09 19:06:41 +00:00
|
|
|
pname = "example-bundled";
|
2022-06-19 01:24:56 +00:00
|
|
|
version = "0.1.0";
|
2022-09-09 19:06:41 +00:00
|
|
|
|
2022-09-09 14:36:35 +00:00
|
|
|
src = ./.;
|
2022-06-19 01:24:56 +00:00
|
|
|
lockfile = ./lock.json;
|
2022-09-09 19:06:41 +00:00
|
|
|
|
|
|
|
output = "bundled.js";
|
|
|
|
entrypoint = "./mod.ts";
|
|
|
|
importMap = "./import_map.json";
|
2022-12-09 05:12:21 +00:00
|
|
|
minify = true;
|
2022-06-19 01:24:56 +00:00
|
|
|
};
|
2022-09-09 19:06:41 +00:00
|
|
|
packages.bundled-wrapper = deno2nix.mkBundledWrapper {
|
|
|
|
pname = "example-bundled-wrapper";
|
2022-06-19 01:24:56 +00:00
|
|
|
version = "0.1.0";
|
2022-09-09 19:06:41 +00:00
|
|
|
|
2022-09-09 14:36:35 +00:00
|
|
|
src = ./.;
|
2022-06-19 01:24:56 +00:00
|
|
|
lockfile = ./lock.json;
|
2022-09-09 19:06:41 +00:00
|
|
|
|
|
|
|
output = "bundled.js";
|
|
|
|
entrypoint = "./mod.ts";
|
|
|
|
importMap = "./import_map.json";
|
2022-06-19 01:24:56 +00:00
|
|
|
};
|
2022-09-09 14:36:35 +00:00
|
|
|
packages.executable = deno2nix.mkExecutable {
|
2022-09-09 19:06:41 +00:00
|
|
|
pname = "example-executable";
|
|
|
|
version = "0.1.2";
|
|
|
|
|
2022-09-09 14:36:35 +00:00
|
|
|
src = ./.;
|
2022-06-19 01:24:56 +00:00
|
|
|
lockfile = ./lock.json;
|
2022-09-09 19:06:41 +00:00
|
|
|
|
|
|
|
output = "example";
|
|
|
|
entrypoint = "./mod.ts";
|
|
|
|
importMap = "./import_map.json";
|
2022-06-19 01:24:56 +00:00
|
|
|
};
|
2022-08-03 23:28:28 +00:00
|
|
|
packages.default = self.packages.${system}.executable;
|
|
|
|
defaultPackage = self.packages.${system}.default;
|
2022-06-19 01:24:56 +00:00
|
|
|
|
2022-09-09 19:06:41 +00:00
|
|
|
apps.bundled-wrapper = flake-utils.lib.mkApp {drv = self.packages.${system}.bundled-wrapper;};
|
|
|
|
apps.executable = flake-utils.lib.mkApp {drv = self.packages.${system}.executable;};
|
|
|
|
apps.default = self.apps.${system}.executable;
|
2022-06-19 01:24:56 +00:00
|
|
|
|
2022-08-03 23:28:28 +00:00
|
|
|
checks = self.packages.${system};
|
|
|
|
|
2022-09-09 14:36:35 +00:00
|
|
|
devShells.default = pkgs.devshell.mkShell {
|
|
|
|
packages = with pkgs; [
|
|
|
|
alejandra
|
|
|
|
deno
|
|
|
|
treefmt
|
|
|
|
taplo-cli
|
|
|
|
];
|
|
|
|
commands = [
|
|
|
|
{
|
|
|
|
package = "treefmt";
|
|
|
|
category = "formatters";
|
|
|
|
}
|
2022-06-19 01:24:56 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|