Nix flake to for bun.sh. A fast NodeJS runtime
This bun
nix
flake assumes you have already installed nix
{
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
nix run github:rupurt/bun-nix -- --version
- Alex Kwiatkowski - [email protected]
bun-nix
is released under the MIT license