deno2.nix/flake.nix
Xe b42f691c27 flake: make devshell follow other inputs to reduce noise
Signed-off-by: Xe <me@christine.website>
2022-12-08 23:42:01 -05:00

108 lines
2.6 KiB
Nix

{
# main
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
# dev
inputs = {
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";
flake = false;
};
};
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs:
{
overlays.default = import ./nix/overlay.nix;
overlay = self.overlays.default;
}
// flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
]
(
system: let
inherit (pkgs) deno2nix;
pkgs = import nixpkgs {
inherit system;
overlays = with inputs; [
self.overlays.default
devshell.overlay
];
};
in {
packages.depslink = deno2nix.internal.mkDepsLink ./lock.json;
packages.bundled = deno2nix.mkBundled {
pname = "example-bundled";
version = "0.1.0";
src = ./.;
lockfile = ./lock.json;
output = "bundled.js";
entrypoint = "./mod.ts";
importMap = "./import_map.json";
};
packages.bundled-wrapper = deno2nix.mkBundledWrapper {
pname = "example-bundled-wrapper";
version = "0.1.0";
src = ./.;
lockfile = ./lock.json;
output = "bundled.js";
entrypoint = "./mod.ts";
importMap = "./import_map.json";
};
packages.executable = deno2nix.mkExecutable {
pname = "example-executable";
version = "0.1.2";
src = ./.;
lockfile = ./lock.json;
output = "example";
entrypoint = "./mod.ts";
importMap = "./import_map.json";
};
packages.default = self.packages.${system}.executable;
defaultPackage = self.packages.${system}.default;
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;
checks = self.packages.${system};
devShells.default = pkgs.devshell.mkShell {
packages = with pkgs; [
alejandra
deno
treefmt
taplo-cli
];
commands = [
{
package = "treefmt";
category = "formatters";
}
];
};
}
);
}