https://github.com/rupurt/bun-nix
Nix flake for bun.sh
https://github.com/rupurt/bun-nix
Last synced: over 1 year ago
JSON representation
Nix flake for bun.sh
- Host: GitHub
- URL: https://github.com/rupurt/bun-nix
- Owner: rupurt
- License: mit
- Created: 2023-11-08T22:34:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-27T06:49:21.000Z (over 2 years ago)
- Last Synced: 2025-02-05T06:46:24.134Z (over 1 year ago)
- Language: Nix
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bun-nix
Nix flake to for [bun.sh](https://bun.sh). A fast NodeJS runtime
## Usage
This `bun` `nix` flake assumes you have already [installed nix](https://determinate.systems/posts/determinate-nix-installer)
### Option 1. Use the `bun` CLI within your own flake
```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.
```sh
# run from devshell
nix develop -c $SHELL
bun --version
```
```sh
# run as application
nix run .#bun -- --version
```
### Option 2. Run the `bun` CLI directly with `nix run`
```nix
nix run github:rupurt/bun-nix -- --version
```
## Authors
- Alex Kwiatkowski - alex+git@fremantle.io
## License
`bun-nix` is released under the MIT license