Skip to content

Commit d0b2c97

Browse files
build(nix): take dprint from the sandboxed systemfsoftware/dprint flake and drop the bin/dprint wrapper (#44)
## Summary Take dprint from the sandboxed `systemfsoftware/dprint` flake instead of core's build, and drop the committed `bin/dprint` wrapper. dprint now arrives on PATH from the dev shell, and every caller runs bare `dprint`. - `flake.nix`: add `dprint.url = "github:systemfsoftware/dprint";` with no `nixpkgs` follows on it, use `dprint.packages.${system}.default` in the dev shell, and drop the `dprint` package re-export. `core` stays only for its `nixpkgs`. - Delete `bin/dprint`. - `package.json`, `.github/workflows/ci.yml`, `.github/actions/checks-lane/action.yml`: call `dprint` instead of the wrapper; the checks lane puts dprint on `GITHUB_PATH` from the dev shell. - `AGENTS.md`, `CONTRIBUTING.md`: drop the `bin/dprint` and "its dprint build" mentions. ## Evidence After (this branch, committed tree): 1. `git grep -nE '(bin|scripts)/dprint|nix/dprint\.nix' -- ':!docs/plans' ':!repos' ':!CHANGELOG.md'` prints nothing. 2. `nix develop --accept-flake-config -c sh -c 'readlink -f "$(command -v dprint)"'` prints `/nix/store/sywvpwdas322nv6gc7w9rjj8zsp572dk-dprint/bin/dprint`. `nix build github:systemfsoftware/dprint#default --dry-run --no-link` lists no "will be built" entries, so it is substituted. 3. `nix develop --accept-flake-config -c dprint check` exits 0. 4. `nix develop --accept-flake-config -c dprint fmt` then `git diff --exit-code` exits 0. 5. This repo has no lint-staged, husky or pre-commit path, so N/A. The `format` script (`dprint fmt`) on a whitespace-only change to `README.md` restored it to `HEAD` bytes. Before (`main`): 1. The grep found `./bin/dprint` in `package.json` (three scripts), `.github/workflows/ci.yml`, and a `bin/dprint` mention in `CONTRIBUTING.md`. 2. `readlink -f "$(command -v dprint)"` printed `/nix/store/zxxzdm1xsbnkh8k26f0lif51m96hszkx-dprint-0.54.0/bin/dprint` (core). 3. `./bin/dprint check` exited 0. 4. `./bin/dprint fmt` then `git diff --exit-code` exited 0. Tests and CI were not run locally; CI runs them. Merged with admin rights: the required approval was the only blocker. CI passed, and the cross-model review left no unresolved P0/P1. --------- Co-authored-by: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com>
1 parent ab7bfd2 commit d0b2c97

8 files changed

Lines changed: 77 additions & 51 deletions

File tree

‎.github/actions/checks-lane/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ runs:
7474
if: inputs.lane == 'static'
7575
- uses: cachix/install-nix-action@v31
7676
if: inputs.lane == 'static' || inputs.lane == 'docs'
77-
- name: dprint from the flake
77+
- name: dprint from the dev shell
7878
if: inputs.lane == 'static' || inputs.lane == 'docs'
7979
shell: bash -e {0}
80-
run: echo "$(nix build --no-link --print-out-paths .#dprint)/bin" >> "$GITHUB_PATH"
80+
run: echo "$(dirname "$(nix develop --accept-flake-config --command sh -c 'command -v dprint')")" >> "$GITHUB_PATH"
8181
- name: Turbo cache
8282
if: inputs.lane == 'static'
8383
uses: actions/cache@v6

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ permissions:
1515

1616
jobs:
1717
checks:
18-
uses: systemfsoftware/systemfsoftware/.github/workflows/reusable-ci.yml@f271b208fd10c56d27380de6bc43f54b9c7ee2a5
18+
uses: systemfsoftware/systemfsoftware/.github/workflows/reusable-ci.yml@9e947ae10f72d9614e9dbd702bd2c424aceb7099
1919
with:
2020
commitlint: true
2121
changeset: false
2222
fast: |
23-
s=0; ./bin/dprint check || s=1
23+
s=0; dprint check || s=1
2424
export TURBO_SCM_BASE="$BASE" TURBO_SCM_HEAD="$HEAD"
2525
pnpm exec turbo run --concurrency=${TURBO_CONCURRENCY:-50%} --continue build lint typecheck test:types api:check attw --affected || s=1
2626
exit $s

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Extracted from `systemfsoftware/systemfsoftware` (core); package history came wi
1616

1717
`@systemfsoftware` packages come from npm like any other dependency: package manifests and catalogs name caret
1818
ranges and `pnpm-lock.yaml` holds the exact versions. Take newer ones with `pnpm update '@systemfsoftware/*'`.
19-
`flake.nix` pins core at a full commit (input `core`) only for its dprint build and its nixpkgs.
19+
`flake.nix` pins core at a full commit (input `core`) only for its nixpkgs.
2020

2121
Local setup:
2222

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
- Node.js 24
77
- pnpm (the version pinned in `package.json`'s `packageManager`)
88

9-
The dev shell (`nix develop`, or direnv) puts every tool on PATH, `bin/dprint` included; on a bare
10-
shell that has nix the wrapper scripts resolve what they need themselves.
9+
The dev shell (`nix develop`, or direnv) puts every tool on PATH, dprint included.
1110

1211
## Dependencies on core
1312

1413
`@systemfsoftware` packages come from npm like any other dependency: package manifests and catalogs name caret ranges and `pnpm-lock.yaml` holds the exact versions. Run `pnpm update '@systemfsoftware/*'` to take newer ones.
1514

16-
`flake.nix` pins core at a full commit (input `core`) only for its dprint build and its nixpkgs.
15+
`flake.nix` pins core at a full commit (input `core`) only for its nixpkgs.
1716

1817
## Setup and workflow
1918

‎bin/dprint‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎flake.lock‎

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

‎flake.nix‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77
};
88

99
inputs = {
10-
# Core at a full commit, for its dprint build and its nixpkgs.
1110
core.url = "github:systemfsoftware/systemfsoftware/e1c7a5f4655d1705de502ebe0de3c1fa87e35591";
1211
nixpkgs.follows = "core/nixpkgs";
1312
pnpm-release-management.url = "github:systemfsoftware/pnpm-release-management";
13+
dprint.url = "github:systemfsoftware/dprint";
1414
};
1515

16-
outputs = { self, nixpkgs, core, pnpm-release-management }:
16+
outputs = { self, nixpkgs, core, pnpm-release-management, dprint }:
1717
let
1818
lib = nixpkgs.lib;
1919
systems = [ "x86_64-linux" "aarch64-linux" ];
2020
forEachSystem = fn: lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
2121

22-
# This repository's own public packages, as tarballs downstream flakes consume the same way.
2322
workspaceOf = pkgs:
2423
pnpm-release-management.lib.mkPnpmWorkspacePackages {
2524
inherit pkgs;
@@ -29,16 +28,12 @@
2928
};
3029
in
3130
{
32-
packages = forEachSystem (pkgs:
33-
let system = pkgs.stdenv.hostPlatform.system; in
34-
workspaceOf pkgs // {
35-
inherit (core.packages.${system}) dprint;
36-
});
31+
packages = forEachSystem workspaceOf;
3732

3833
devShells = forEachSystem (pkgs: {
3934
default = pkgs.mkShell {
4035
packages = [
41-
core.packages.${pkgs.stdenv.hostPlatform.system}.dprint
36+
dprint.packages.${pkgs.stdenv.hostPlatform.system}.default
4237
pkgs.nodejs_24
4338
pkgs.pnpm_12
4439
];

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"lint": "turbo --concurrency=${TURBO_CONCURRENCY:-50%} lint",
1212
"api:check": "turbo --concurrency=${TURBO_CONCURRENCY:-50%} api:check",
1313
"attw": "turbo --concurrency=${TURBO_CONCURRENCY:-50%} attw",
14-
"format": "./bin/dprint fmt",
15-
"format:check": "./bin/dprint check",
16-
"check:static": "s=0; ./bin/dprint check || s=1; turbo --concurrency=${TURBO_CONCURRENCY:-50%} --continue build lint typecheck test:types api:check attw || s=1; exit $s",
14+
"format": "dprint fmt",
15+
"format:check": "dprint check",
16+
"check:static": "s=0; dprint check || s=1; turbo --concurrency=${TURBO_CONCURRENCY:-50%} --continue build lint typecheck test:types api:check attw || s=1; exit $s",
1717
"check:ci": "s=0; pnpm check:static || s=1; turbo --concurrency=${TURBO_CONCURRENCY:-50%} --continue test || s=1; exit $s",
1818
"check:local": "s=0; pnpm check:static || s=1; CONFORMANCE_PROFILE=local VITEST_MAX_WORKERS=${VITEST_MAX_WORKERS:-4} turbo --concurrency=${TURBO_CONCURRENCY:-50%} --continue test || s=1; exit $s",
1919
"prepare": "effect-tsgo patch --oxlint --no-typescript"

0 commit comments

Comments
 (0)