Skip to content

rupurt/bun-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bun-nix

Nix flake to for bun.sh. A fast NodeJS runtime

Usage

This bun nix flake assumes you have already installed nix

Option 1. Use the bun CLI within your own flake

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs";
  inputs.bun-nix.url = "github:rupurt/bun-nix";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = {
    self,
    nixpkgs,
    flake-utils,
    bun-nix,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [
            bun-nix.overlay
          ];
        };
      in
      {
        devShells.default = pkgs.mkShell {
          packages = [
            # to use a specific version tag
            # bun = pkgs.bunpkgs.bun_1_1_12 {};
            #
            # to use a version not exported from this package
            # - get the sha256 for your host `nix hash to-sri --type sha256 $(nix-prefetch-url --unpack https://github.com/oven-sh/bun/releases/download/bun-v1.0.9/bun-linux-x64.zip)`
            # - pass the specialArgs overrides
            # bun = pkgs.bunpkgs.default {
            #   specialArgs = {
            #     version = "1.0.9";
            #     shas = {
            #       x86_64-linux = "sha256-R3l30NssWzt18cRZAidLLsBBBtV3NaCUm8dl4kMvIck="
            #     };
            #   };
            # };
            pkgs.bunpkgs.default
          ];
        };
      }
    );
}

The above config will add bun to your dev shell and also allow you to execute it through the nix CLI utilities.

# run from devshell
nix develop -c $SHELL
bun --version
# run as application
nix run .#bun -- --version

Option 2. Run the bun CLI directly with nix run

nix run github:rupurt/bun-nix -- --version

Authors

License

bun-nix is released under the MIT license

About

Nix flake for bun.sh

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages