Use my-nix-lib for devshell and remove unused package #4

Merged
martin merged 2 commits from my-nix-lib into main 2026-08-02 19:06:32 +00:00
Owner
No description provided.
martin self-assigned this 2026-08-02 14:40:19 +00:00
Use my-nix-lib for devshell and remove unused package
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
fbf2b446d1
Member

Review Summary

This PR consolidates the Rust Nix setup onto the shared my-nix-lib flake: it drops fenix/naersk inputs, deletes .nix/pkgs.nix, and replaces the local dev-shell/package definitions with my.lib.${system}.rust.mkDevShell. The refactor is clean and DRY, and the flake.lock changes are internally consistent (root now inputs my, nixpkgs, flake-utils, treefmt-nix_2; my's own fenix/crane/treefmt-nix are pinned correctly and its nixpkgs follows the root input).

I verified the my-nix-lib API against its source (code.martials.no/Personal/my-nix-lib): mkDevShell accepts { channel, tooltip, packages, shellHook } and resolves the toolchain via fenix.packages.<system>.<channel>.<tooltip>. The passed tooltip = "defaultToolchain" is a valid fenix attribute (fenix generates ${profile}Toolchain for the stable manifest profiles, including defaultToolchain), so the dev-shell will evaluate. The locked my rev (91afe589) also matches the current main of my-nix-lib, so the two flakes are in sync.

Main concern: the PR removes the packages output entirely. The justfile still defines @build-package: nix build (justfile:20-21) and AGENTS.md still documents "Build via rustPlatform.buildPackage at .nix/pkgs.nix"; with no packages.<system>.default attribute, nix build now fails with "flake does not provide attribute 'packages.x86_64-linux.default'". Either restore a package via my.lib.${system}.rust.mkRustPlatform or update AGENTS.md/justfile to reflect that Nix no longer builds the crate.

Minor: the dev-shell no longer installs pkg-config/openssl (the old flake had them explicitly; my-nix-lib only sets LD_LIBRARY_PATH for openssl and adds rust-analyzer), which could matter if any workspace member (e.g. crates/openapi-gen-build) needs build-time openssl headers or pkg-config. Also note the my input is pinned only by a mutable refs/heads/main in the lock — reproducible under --locked, but worth pinning to a rev/tag.


*🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: changes

# Review Summary This PR consolidates the Rust Nix setup onto the shared `my-nix-lib` flake: it drops `fenix`/`naersk` inputs, deletes `.nix/pkgs.nix`, and replaces the local dev-shell/package definitions with `my.lib.${system}.rust.mkDevShell`. The refactor is clean and DRY, and the flake.lock changes are internally consistent (root now inputs `my`, `nixpkgs`, `flake-utils`, `treefmt-nix_2`; `my`'s own `fenix`/`crane`/`treefmt-nix` are pinned correctly and its `nixpkgs` follows the root input). I verified the my-nix-lib API against its source (`code.martials.no/Personal/my-nix-lib`): `mkDevShell` accepts `{ channel, tooltip, packages, shellHook }` and resolves the toolchain via `fenix.packages.<system>.<channel>.<tooltip>`. The passed `tooltip = "defaultToolchain"` is a **valid** fenix attribute (fenix generates `${profile}Toolchain` for the stable manifest profiles, including `defaultToolchain`), so the dev-shell will evaluate. The locked `my` rev (91afe589) also matches the current main of my-nix-lib, so the two flakes are in sync. Main concern: the PR removes the `packages` output entirely. The justfile still defines `@build-package: nix build` (justfile:20-21) and AGENTS.md still documents "Build via `rustPlatform.buildPackage` at `.nix/pkgs.nix`"; with no `packages.<system>.default` attribute, `nix build` now fails with "flake does not provide attribute 'packages.x86_64-linux.default'". Either restore a package via `my.lib.${system}.rust.mkRustPlatform` or update AGENTS.md/justfile to reflect that Nix no longer builds the crate. Minor: the dev-shell no longer installs `pkg-config`/`openssl` (the old flake had them explicitly; my-nix-lib only sets `LD_LIBRARY_PATH` for openssl and adds `rust-analyzer`), which could matter if any workspace member (e.g. `crates/openapi-gen-build`) needs build-time openssl headers or pkg-config. Also note the `my` input is pinned only by a mutable `refs/heads/main` in the lock — reproducible under `--locked`, but worth pinning to a rev/tag. --- *🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: **changes**
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode.
@ -54,3 +34,1 @@
packages = {
default = my-rust-lib;
my-rust-lib = my-rust-lib;
devShells.default = mkDevShell {
Member

[bug] The packages output (and .nix/pkgs.nix) was removed, so nix build no longer has a target: packages.<system>.default is missing and evaluation fails with "flake does not provide attribute 'packages.x86_64-linux.default'". This breaks the documented build path (just build-package in justfile:20-21) and contradicts AGENTS.md ("Build via rustPlatform.buildPackage at .nix/pkgs.nix", "verify.yaml: ... Nix build (Cachix push)"). If the package is still intended to be buildable, expose it via my.lib.${system}.rust.mkRustPlatform (e.g. packages.default = (my.lib.${system}.rust.mkRustPlatform {}).buildPackage ...); otherwise update AGENTS.md and the justfile so the recipe doesn't point at a non-existent target.

[bug] The `packages` output (and `.nix/pkgs.nix`) was removed, so `nix build` no longer has a target: `packages.<system>.default` is missing and evaluation fails with "flake does not provide attribute 'packages.x86_64-linux.default'". This breaks the documented build path (`just build-package` in justfile:20-21) and contradicts AGENTS.md ("Build via `rustPlatform.buildPackage` at `.nix/pkgs.nix`", "verify.yaml: ... Nix build (Cachix push)"). If the package is still intended to be buildable, expose it via `my.lib.${system}.rust.mkRustPlatform` (e.g. `packages.default = (my.lib.${system}.rust.mkRustPlatform {}).buildPackage ...`); otherwise update AGENTS.md and the justfile so the recipe doesn't point at a non-existent target.
Member

[style] The old dev-shell explicitly installed pkg-config and openssl; mkDevShell from my-nix-lib only adds rust-analyzer to packages and sets LD_LIBRARY_PATH for openssl (no pkg-config, no openssl dev headers in the environment). This is fine for a no-dependency library, but if crates/openapi-gen-build or future members need build-time openssl/pkg-config, cargo build inside the shell will fail. Consider passing packages = [ pkgs.pkg-config pkgs.openssl ] to mkDevShell (a supported parameter) to preserve the old behavior.

[style] The old dev-shell explicitly installed `pkg-config` and `openssl`; `mkDevShell` from my-nix-lib only adds `rust-analyzer` to `packages` and sets `LD_LIBRARY_PATH` for openssl (no `pkg-config`, no openssl dev headers in the environment). This is fine for a no-dependency library, but if `crates/openapi-gen-build` or future members need build-time openssl/pkg-config, `cargo build` inside the shell will fail. Consider passing `packages = [ pkgs.pkg-config pkgs.openssl ]` to `mkDevShell` (a supported parameter) to preserve the old behavior.
Remove build nix recipe
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
01135804c8
Member

Review Summary

This PR consolidates the repo's Nix setup by removing the in-repo fenix + naersk toolchain/package logic (.nix/pkgs.nix, packages.* output, just build-package) and delegating to a shared my-nix-lib flake (git+https://code.martials.no/Personal/my-nix-lib). AGENTS.md and flake.lock are updated accordingly.

Overall the direction is good: the shared flake is reused correctly (my.lib.<system>.rust.mkDevShell exists and tooltip = "defaultToolchain" is a valid fenix channel attribute — the rustup default profile — which includes clippy/rustfmt, matching the documented dev shell), nixpkgs is unified via follows, and the treefmt-nix duplication in flake.lock resolves to the same rev (harmless).

The main issues: (1) my-nix-lib only exposes lib.<system> for x86_64-linux and aarch64-linux, but this flake evaluates via flake-utils.eachDefaultSystem (which also includes x86_64-darwin/aarch64-darwin) — on macOS my.lib.<system>.rust is missing and the flake fails to evaluate; (2) removing the packages output means bare nix build now errors with a confusing "does not provide attribute" message, a behavior regression worth confirming as intentional; (3) AGENTS.md still claims verify.yaml runs a "Nix build (Cachix push)" step that doesn't exist in .woodpecker/verify.yaml and is now further from reality.


*🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: changes

# Review Summary This PR consolidates the repo's Nix setup by removing the in-repo fenix + naersk toolchain/package logic (`.nix/pkgs.nix`, `packages.*` output, `just build-package`) and delegating to a shared `my-nix-lib` flake (`git+https://code.martials.no/Personal/my-nix-lib`). AGENTS.md and flake.lock are updated accordingly. Overall the direction is good: the shared flake is reused correctly (`my.lib.<system>.rust.mkDevShell` exists and `tooltip = "defaultToolchain"` is a valid fenix channel attribute — the rustup `default` profile — which includes clippy/rustfmt, matching the documented dev shell), nixpkgs is unified via `follows`, and the treefmt-nix duplication in flake.lock resolves to the same rev (harmless). The main issues: (1) `my-nix-lib` only exposes `lib.<system>` for `x86_64-linux` and `aarch64-linux`, but this flake evaluates via `flake-utils.eachDefaultSystem` (which also includes `x86_64-darwin`/`aarch64-darwin`) — on macOS `my.lib.<system>.rust` is missing and the flake fails to evaluate; (2) removing the `packages` output means bare `nix build` now errors with a confusing "does not provide attribute" message, a behavior regression worth confirming as intentional; (3) AGENTS.md still claims verify.yaml runs a "Nix build (Cachix push)" step that doesn't exist in `.woodpecker/verify.yaml` and is now further from reality. --- *🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: **changes**
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode.
Member

[style] Pre-existing staleness that this PR makes more inaccurate: the CI section still claims verify.yaml runs "Build → Test → Clippy (strict) → Nix build (Cachix push)", but .woodpecker/verify.yaml only has Build/Test/Clippy and no Nix step. Since this PR removes the Nix package output, this line should be corrected to just "Build → Test → Clippy (strict)".

[style] Pre-existing staleness that this PR makes more inaccurate: the CI section still claims `verify.yaml` runs "Build → Test → Clippy (strict) → Nix build (Cachix push)", but `.woodpecker/verify.yaml` only has Build/Test/Clippy and no Nix step. Since this PR removes the Nix package output, this line should be corrected to just "Build → Test → Clippy (strict)".
@ -49,3 +30,1 @@
my-rust-lib = import ./.nix/pkgs.nix pkgsInputs;
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
inherit (my.lib.${system}.rust) mkDevShell;
Member

[bug] my.lib.${system} is only defined for x86_64-linux and aarch64-linux in my-nix-lib (its perSystem iterates those two systems only), but this flake evaluates through flake-utils.eachDefaultSystem, which also covers x86_64-darwin and aarch64-darwin. On macOS the lookup my.lib.aarch64-darwin.rust will be missing and the flake fails to evaluate (broken nix develop/nix flake check). Either iterate only the systems my-nix-lib supports (e.g. flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ]) or add a fallback devShell for darwin.

[bug] `my.lib.${system}` is only defined for `x86_64-linux` and `aarch64-linux` in `my-nix-lib` (its `perSystem` iterates those two systems only), but this flake evaluates through `flake-utils.eachDefaultSystem`, which also covers `x86_64-darwin` and `aarch64-darwin`. On macOS the lookup `my.lib.aarch64-darwin.rust` will be missing and the flake fails to evaluate (broken `nix develop`/`nix flake check`). Either iterate only the systems `my-nix-lib` supports (e.g. `flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ]`) or add a fallback devShell for darwin.
@ -54,3 +34,1 @@
packages = {
default = my-rust-lib;
my-rust-lib = my-rust-lib;
devShells.default = mkDevShell {
Member

[style] The packages.default / packages.my-rust-lib output (previously built via .nix/pkgs.nix) is removed entirely, so bare nix build now fails with "flake does not provide attribute 'packages.x86_64-linux.default'" and the crate can no longer be built/installed via Nix. If the Nix build capability is intentionally dropped (crate is published to the Cargo registry), consider leaving a packages.default = self.checks... or a comment; alternatively re-add it using my-nix-lib's crane helpers (mkCraneLib/mkRustPlatform). At minimum, note this in the PR description.

[style] The `packages.default` / `packages.my-rust-lib` output (previously built via `.nix/pkgs.nix`) is removed entirely, so bare `nix build` now fails with "flake does not provide attribute 'packages.x86_64-linux.default'" and the crate can no longer be built/installed via Nix. If the Nix build capability is intentionally dropped (crate is published to the Cargo registry), consider leaving a `packages.default = self.checks...` or a comment; alternatively re-add it using `my-nix-lib`'s crane helpers (`mkCraneLib`/`mkRustPlatform`). At minimum, note this in the PR description.
martin merged commit 4fd650f4fd into main 2026-08-02 19:06:32 +00:00
martin deleted branch my-nix-lib 2026-08-02 19:06:32 +00:00
Sign in to join this conversation.
No description provided.