https://github.com/daste745/nix-bun
Nix flake with all bunjs versions kept up to date daily
https://github.com/daste745/nix-bun
bun bunjs nix nix-flake
Last synced: about 1 month ago
JSON representation
Nix flake with all bunjs versions kept up to date daily
- Host: GitHub
- URL: https://github.com/daste745/nix-bun
- Owner: Daste745
- License: mit
- Created: 2025-10-05T21:36:54.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-10-05T22:06:11.000Z (9 months ago)
- Last Synced: 2025-10-05T23:35:14.500Z (9 months ago)
- Topics: bun, bunjs, nix, nix-flake
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# nix-bun
All [Bun releases](https://github.com/oven-sh/bun/releases) as separate nix packages, updated daily.
Bun is built for the following systems. All are available in nix-bun:
- `aarch64-darwin`
- `aarch64-linux`
- `x86_64-darwin`
- `x86_64-linux`
## Usage
### flake.nix
When using flakes, you can access all versions via `packages.${system}."version"`.
```nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
bun = {
url = "github:Daste745/nix-bun";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
let
system = "x86_64-linux";
pkgs = import inputs.nixpkgs { inherit system; };
bun = inputs.bun.packages.${system};
in
{
devShells.${system}.default = pkgs.mkShell {
# All versions can be accessed via `bun."version"`
packages = [ bun."1.3.0" ];
};
};
}
```
### shell.nix (without flakes)
Without flakes, import nix-bun using nixpkgs for the target system. All versions are available as toplevel attributes of `default.nix`'s output.
This can be combined with [npins](https://github.com/andir/npins) or [niv](https://github.com/nmattia/niv) for more convenient flake-less dependency pinning.
```nix
{
pkgs ? import { },
}:
let
# Also, preferrably lock to a specific commit + sha256
nix-bun = fetchTarball "https://github.com/Daste745/nix-bun/archive/main.tar.gz";
bun = import nix-bun { inherit pkgs; };
in
pkgs.mkShell {
# All versions can be accessed via `bun."version"`
packages = [ bun."1.3.0" ];
}
```
### Temporary nix shell
Use `#'"version"'` to select a specific version of Bun to avoid shells unescaping the version:
```sh
$ nix shell github:Daste745/nix-bun#'"1.3.0"'
```
## References
- [oven-sh/bun](https://github.com/oven-sh/bun)
- [0xBigBoss/bun-overlay](https://github.com/0xBigBoss/bun-overlay)
- [cachix/nixpkgs-python](https://github.com/cachix/nixpkgs-python)