Skip to content

Commit c4545e1

Browse files
committed
build(ccusage): run nushell check from nix shebang
Make the native-binary check executable and let the script acquire Nushell through a Nix shebang pinned to the repository flake inputs. The package build no longer needs nushell installed into the lightweight CI or release profiles, and the dev shell does not need to add nushell just for this prepack script. The cargo fallback still works when the script is invoked from the project dev shell.
1 parent 82b37b2 commit c4545e1

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ jobs:
141141
- uses: ./.github/actions/setup-nix-cache
142142
# Packing only repackages the native binaries restored from the build
143143
# matrix below (no Rust build happens here), so the full `nix develop` dev
144-
# shell is unnecessary. The prepack scripts run tsdown (node) and
145-
# ensure-native-binary (Nushell), so provision those runtimes explicitly.
146-
- run: nix profile install --inputs-from . nixpkgs#pnpm nixpkgs#nodejs nixpkgs#nushell
144+
# shell is unnecessary. The prepack scripts run tsdown with node; the
145+
# ensure-native-binary script brings Nushell through its Nix shebang.
146+
- run: nix profile install --inputs-from . nixpkgs#pnpm nixpkgs#nodejs
147147
- run: pnpm install --frozen-lockfile
148148
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
149149
with:

‎.github/workflows/release.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ jobs:
8888
node-version: lts/*
8989
package-manager-cache: false
9090
# node comes from setup-node above (needed for the npm registry auth);
91-
# nushell is required by the ensure-native-binary prepack script.
92-
- run: nix profile install --inputs-from . nixpkgs#pnpm nixpkgs#nushell
91+
# ensure-native-binary brings Nushell through its Nix shebang.
92+
- run: nix profile install --inputs-from . nixpkgs#pnpm
9393
- run: pnpm install --frozen-lockfile
9494
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
9595
with:

‎apps/ccusage/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"bench": "node scripts/bench.mjs",
3232
"build": "tsdown && pnpm run ensure:native-binary",
3333
"build:rust": "cargo build --manifest-path ../../rust/Cargo.toml --release --bin ccusage",
34-
"ensure:native-binary": "nu scripts/ensure-native-binary.nu",
34+
"ensure:native-binary": "scripts/ensure-native-binary.nu",
3535
"generate:schema": "cargo run --quiet --manifest-path ../../rust/Cargo.toml --bin generate-config-schema -- config-schema.json && oxfmt --write config-schema.json && cp config-schema.json ../../docs/public/config-schema.json",
3636
"prepack": "pnpm run build && clean-pkg-json",
3737
"start": "cargo run --manifest-path ../../rust/Cargo.toml --bin ccusage --",

‎apps/ccusage/scripts/ensure-native-binary.nu‎

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env nu
1+
#!/usr/bin/env nix
2+
#! nix shell --inputs-from ../../.. nixpkgs#nushell --command nu
23

34
const system_dylib_prefixes = [
45
'/usr/lib/',

‎nix/dev-shell.nix‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ in
2323
nodejs
2424
pnpm
2525
bun
26-
nushell
2726

2827
rustToolchain
2928
cargo-edit

0 commit comments

Comments
 (0)