Skip to content

Add nix flake with devshell, formatting, build and checks#773

Merged
hazre merged 1 commit intoSableClient:devfrom
bitfl0wer:flori/flake
May 8, 2026
Merged

Add nix flake with devshell, formatting, build and checks#773
hazre merged 1 commit intoSableClient:devfrom
bitfl0wer:flori/flake

Conversation

@bitfl0wer
Copy link
Copy Markdown
Contributor

@bitfl0wer bitfl0wer commented May 7, 2026

Description

this nix flake is heavily based off of prior work i have done in one of my repos. it comes with the following features:

  • building sable: nix build .#sable or just nix build. creates a result/ dir with the built application.
  • devshell: nix users now no longer need to do download and install all the dependencies for sable by themselves. the devshell comes with all the dependencies needed to develop sable
  • checks: nix flake check is configured to lint and test:run the application, in addition to checking for correct formatting
  • formatting: nix fmt runs all the formatters pnpm would also call, but provides a more familiar interface for nix users.
  • pre-commit checks: nix users can benefit from having their changes checked for before the commit goes through. yay :3

.vscode/settings.json was updated to include hints for VS Code users using the "nix env selector" extension to auto-detect the nix dev environment, if you have nix installed.

I had to change oxfmt.config.ts just a tiny bit to make it work with the nix stuff, because node_modules does not exist inside the nix build sandbox. pnpm fmt successfully runs, so nothing should have broken.

flake-lock-fix.yml is a small workflow heavily based on https://docs.determinate.systems/guides/fix-hashes/, which triggers on pushes to dev which change pnpm-lock.yaml. The workflow uses determinate-nixd to fix hashes in the flake.nix, then pushes the changes to dev automatically.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

@bitfl0wer bitfl0wer requested review from 7w1 and hazre as code owners May 7, 2026 19:13
@7w1 7w1 added the internal label May 7, 2026
@bitfl0wer bitfl0wer marked this pull request as draft May 7, 2026 19:16
@bitfl0wer bitfl0wer force-pushed the flori/flake branch 4 times, most recently from a382df0 to 7485a0d Compare May 7, 2026 19:22
@bitfl0wer bitfl0wer marked this pull request as ready for review May 7, 2026 19:23
@bitfl0wer
Copy link
Copy Markdown
Contributor Author

bitfl0wer commented May 7, 2026

After reading through CONTRIBUTING.md more thoroughly, I decided to add all 5 checks mentioned there into nix flake check, instead of just test:run, lint and fmt:check.

edit(5e2fccc): just changed email so that the commit is now verified :)

this nix flake is heavily based off of prior work i have done in one of my
repos. it comes with the following features:

- building sable: `nix build .#sable` or just `nix build`. creates a `result/`
  dir with the built application.
- devshell: nix users now no longer need to do download and install all the
  dependencies for sable by themselves. the devshell comes with all the
  dependencies needed to develop sable
- checks: `nix flake check` is configured to perform all checks listed in
  `CONTRIBUTING.md` (fmt:check, lint, typecheck, knip, test:run)
- formatting: `nix fmt` runs all the formatters pnpm would also call, but
  provides a more familiar interface for nix users.
- pre-commit checks: nix users can benefit from having their changes checked for
  before the commit goes through. yay :3

`.vscode/settings.json` was updated to include hints for VS Code users using the
"nix env selector" extension to auto-detect the nix dev environment, if you have
nix installed.

I had to change `oxfmt.config.ts` just a tiny bit to make it work with the nix
stuff, because `node_modules` does not exist inside the nix build sandbox. `pnpm
fmt` successfully runs, so nothing should have broken.

`flake-lock-fix.yml` is a small workflow heavily based on
<https://docs.determinate.systems/guides/fix-hashes/>, which triggers on pushes
to `dev` which change `pnpm-lock.yaml`. The workflow uses `determinate-nixd` to
fix hashes in the `flake.nix`, then pushes the changes to `dev` automatically.
Copy link
Copy Markdown
Member

@hazre hazre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!! :3

@hazre hazre added this pull request to the merge queue May 8, 2026
Merged via the queue into SableClient:dev with commit f07fb1b May 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants