Find a file
dependabot[bot] 296c4234db
Bump cachix/cachix-action from 11 to 12 (#17)
Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 11 to 12.
- [Release notes](https://github.com/cachix/cachix-action/releases)
- [Commits](https://github.com/cachix/cachix-action/compare/v11...v12)

---
updated-dependencies:
- dependency-name: cachix/cachix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-09 16:26:30 +09:00
.github Bump cachix/cachix-action from 11 to 12 (#17) 2022-12-09 16:26:30 +09:00
.vscode fx .vscode/settings.json 2022-06-19 11:03:26 +09:00
nix nix/make-bundled: add minification option 2022-12-09 00:12:21 -05: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 refactor: Fix and rename arg names (#9) 2022-09-10 04:06:41 +09:00
flake.lock update nixpkgs and devshell 2022-12-08 23:52:45 -05:00
flake.nix nix/make-bundled: add minification option 2022-12-09 00:12:21 -05:00
import_map.json setup env 2022-06-19 10:24:56 +09:00
lock.json nix/internal: work with v2 lock files 2022-12-08 23:52:36 -05:00
mod.ts setup env 2022-06-19 10:24:56 +09:00
README.md refactor: Fix and rename arg names (#9) 2022-09-10 04:06:41 +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 = {
    self,
    nixpkgs,
    flake-utils,
    ...
  } @ inputs:
    flake-utils.lib.eachDefaultSystem (system: let
      inherit (pkgs) deno2nix;
      pkgs = import nixpkgs {
        inherit system;
        overlays = with inputs; [
          devshell.overlay
          deno2nix.overlay
        ];
      };
    in {
      packages.executable = deno2nix.mkExecutable {
        pname = "example-executable";
        version = "0.1.2";

        src = ./.;
        lockfile = ./lock.json;

        output = "example";
        entrypoint = "./mod.ts";
        importMap = "./import_map.json";
      };
    });
}

deno2nix.mkExecutable

Args

{
  pname,
  version,
  src,
  lockfile,
  output ? pname, # generate binary name
  entrypoint,
  importMap ? null, # ex. "./import_map.json" to $src/${importMap}
  additionalDenoFlags ? "", # ex. "--allow-net"
}

Thanks