deno2.nix/flake.nix

109 lines
2.7 KiB
Nix
Raw Normal View History

2022-06-19 01:24:56 +00:00
{
# main
2022-06-19 01:24:56 +00:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
2022-06-19 01:24:56 +00:00
# dev
inputs = {
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
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-06-19 01:24:56 +00:00
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs:
2022-08-03 23:28:28 +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"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
2022-06-19 01:24:56 +00:00
]
(
system: let
inherit (pkgs) deno2nix;
2022-06-19 01:24:56 +00:00
pkgs = import nixpkgs {
inherit system;
overlays = with inputs; [
2022-08-03 23:28:28 +00:00
self.overlays.default
devshell.overlay
2022-06-19 01:24:56 +00:00
];
};
2022-08-03 23:28:28 +00:00
in {
packages.depslink = deno2nix.internal.mkDepsLink ./lock.json;
packages.bundled = deno2nix.mkBundled {
pname = "example-bundled";
2022-06-19 01:24:56 +00:00
version = "0.1.0";
src = ./.;
2022-06-19 01:24:56 +00:00
lockfile = ./lock.json;
output = "bundled.js";
entrypoint = "./mod.ts";
importMap = "./import_map.json";
minify = true;
2022-06-19 01:24:56 +00:00
};
packages.bundled-wrapper = deno2nix.mkBundledWrapper {
pname = "example-bundled-wrapper";
2022-06-19 01:24:56 +00:00
version = "0.1.0";
src = ./.;
2022-06-19 01:24:56 +00:00
lockfile = ./lock.json;
output = "bundled.js";
entrypoint = "./mod.ts";
importMap = "./import_map.json";
2022-06-19 01:24:56 +00:00
};
packages.executable = deno2nix.mkExecutable {
pname = "example-executable";
version = "0.1.2";
src = ./.;
2022-06-19 01:24:56 +00:00
lockfile = ./lock.json;
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
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};
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
];
};
}
);
}