Skip to content

Commit 5a6d7e9

Browse files
committed
build(nix): migrate to bun2nix v2 and fix other checks
* Updated `bun2nix` to v2.0.1, regenerated `bun.nix` * Use `bun2nix` npm package for `postinstall` script so that it works both inside and outside a nix devshell * Migrated `www` builds to new bun2nix APIs to fix build-time errors * Fixed `cargo-deny` checks failing by reordering the `--hide-inclusion-graph` flag to be after the `check` command * Excluded generated `bun.nix` fixed-output derivation file from `treefmt `formatting
1 parent 2639d2e commit 5a6d7e9

File tree

5 files changed

+1153
-1731
lines changed

5 files changed

+1153
-1731
lines changed

flake.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
flake-utils.url = "github:numtide/flake-utils";
77
crane.url = "github:ipetkov/crane";
88
rust-overlay.url = "github:oxalica/rust-overlay";
9-
bun2nix.url = "github:baileyluTCD/bun2nix";
9+
bun2nix.url = "github:nix-community/bun2nix";
1010

1111
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
1212
bun2nix.inputs.nixpkgs.follows = "nixpkgs";
@@ -27,12 +27,14 @@
2727
let
2828
pkgs = import nixpkgs {
2929
inherit system;
30-
overlays = [ (import rust-overlay) ];
30+
overlays = [
31+
(import rust-overlay)
32+
bun2nix.overlays.default
33+
];
3134
};
3235

3336
# --- Libraries ---
3437
lib = pkgs.lib;
35-
bunLib = bun2nix.lib.${system};
3638
craneLib = (crane.mkLib pkgs).overrideToolchain (
3739
toolchain:
3840
toolchain.rust-bin.nightly."2025-06-20".default.override {
@@ -46,10 +48,14 @@
4648
);
4749

4850
# Build www project
49-
www = bunLib.mkBunDerivation {
50-
bunNix = ./www/bun.nix;
51+
www = pkgs.stdenv.mkDerivation {
52+
name = "ssh-portfolio-www";
5153
packageJson = ./www/package.json;
5254
src = ./www;
55+
56+
nativeBuildInputs = [ pkgs.bun2nix.hook ];
57+
bunDeps = pkgs.bun2nix.fetchBunDeps { bunNix = ./www/bun.nix; };
58+
5359
buildPhase = ''
5460
bun run build
5561
'';
@@ -132,9 +138,12 @@
132138
);
133139

134140
ssh-portfolio = pkgs.callPackage crate { };
135-
ssh-portfolio-deny = craneLib.cargoDeny commonCraneArgs // {
136-
cargoDenyExtraArgs = "--hide-inclusion-graph";
137-
};
141+
ssh-portfolio-deny = craneLib.cargoDeny (
142+
commonCraneArgs
143+
// {
144+
cargoDenyChecks = "--hide-inclusion-graph bans licenses sources";
145+
}
146+
);
138147

139148
in
140149
{
@@ -150,7 +159,7 @@
150159
set -euo pipefail
151160
cp -r ${./.} workdir
152161
chmod -R +w workdir/
153-
treefmt --ci --tree-root workdir/
162+
treefmt --ci --tree-root workdir/ --excludes '**/bun.nix'
154163
touch $out
155164
'';
156165
};

www/bun.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@sveltejs/vite-plugin-svelte": "^6.2.0",
1212
"@tailwindcss/vite": "^4.1.13",
1313
"@types/node": "^24.5.2",
14+
"bun2nix": "^2.0.1",
1415
"esbuild": "^0.25.10",
1516
"eslint": "^9.36.0",
1617
"eslint-config-prettier": "^10.1.8",
@@ -261,6 +262,8 @@
261262

262263
"braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
263264

265+
"bun2nix": ["bun2nix@2.0.1", "", { "dependencies": { "sade": "^1.8.1" }, "bin": { "bun2nix": "index.ts" } }, "sha512-DYRxOPa+HP2cpJWYFigytOiG6u0Jq/wyD2fbdlmGvJ1vxzigLGLzMmnv/pbt5t8W3CUxxypdaEVS7bUitGTJyQ=="],
266+
264267
"callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="],
265268

266269
"chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],

0 commit comments

Comments
 (0)