Find a file
2022-06-20 07:59:52 +09:00
.vscode fx .vscode/settings.json 2022-06-19 11:03:26 +09:00
nix 軽微な修正 2022-06-19 10:42:24 +09:00
.editorconfig setup env 2022-06-19 10:24:56 +09:00
.envrc setup env 2022-06-19 10:24:56 +09:00
.gitignore setup env 2022-06-19 10:24:56 +09:00
default.nix setup env 2022-06-19 10:24:56 +09:00
deno.jsonc setup env 2022-06-19 10:24:56 +09:00
devshell.toml update_lockfile command 2022-06-19 10:46:40 +09:00
flake.lock setup env 2022-06-19 10:24:56 +09:00
flake.nix provide as lib 2022-06-20 07:59:52 +09:00
import_map.json setup env 2022-06-19 10:24:56 +09:00
lock.json setup env 2022-06-19 10:24:56 +09:00
mod.ts setup env 2022-06-19 10:24:56 +09:00
overlay.nix setup env 2022-06-19 10:24:56 +09:00
README.md readme fix 2022-06-19 10:46:24 +09:00
shell.nix setup env 2022-06-19 10:24:56 +09:00
treefmt.toml setup env 2022-06-19 10:24:56 +09:00

deno2nix

Nix support for Deno

Usage

  • lockfile -> ./lock.json
  • import map -> ./import_map.json
  • entrypoint -> ./mod.ts

Update lock.json for caching

deno cache --import-map=./import_map.json --lock lock.json --lock-write ./mod.ts

Setup for nix flake (example)

{
  inputs.deno2nix.url = "github:SnO2WMaN/deno2nix";
  inputs.devshell.url = "github:numtide/devshell";

  outputs = {
    deno2nix,
    flake-utils,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        inherit system;
        overlays = [
          devshell.overlay
          deno2nix.overlay
        ];
      };
    in {
      packages.executable = pkgs.deno2nix.mkExecutable {
        name = "example";
        version = "0.1.0";
        src = self;
        lockfile = ./lock.json;
        importmap = ./import_map.json;
        entrypoint = ./mod.ts;
      };
    });
}

deno2nix.mkExecutable

Args

 {
    name,
    version,
    src,
    entrypoint,
    lockfile,
    importmap ? null,
    denoFlags ? [],
}
  • importMap = ./import_map.json
  • denoFlags = ["--allow-net" true]

Thanks