Use my-nix-lib for devshell and remove unused package #4
No reviewers
Labels
No labels
automerge
bug
dependencies
duplicate
help wanted
invalid
lang
rust
migrations
opencode
question
security
type
documentation
type
enhancement
type
maintenance
type
refactor
vulnerability
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Personal/my-rust-lib!4
Loading…
Reference in a new issue
No description provided.
Delete branch "my-nix-lib"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Review Summary
This PR consolidates the Rust Nix setup onto the shared
my-nix-libflake: it dropsfenix/naerskinputs, deletes.nix/pkgs.nix, and replaces the local dev-shell/package definitions withmy.lib.${system}.rust.mkDevShell. The refactor is clean and DRY, and the flake.lock changes are internally consistent (root now inputsmy,nixpkgs,flake-utils,treefmt-nix_2;my's ownfenix/crane/treefmt-nixare pinned correctly and itsnixpkgsfollows the root input).I verified the my-nix-lib API against its source (
code.martials.no/Personal/my-nix-lib):mkDevShellaccepts{ channel, tooltip, packages, shellHook }and resolves the toolchain viafenix.packages.<system>.<channel>.<tooltip>. The passedtooltip = "defaultToolchain"is a valid fenix attribute (fenix generates${profile}Toolchainfor the stable manifest profiles, includingdefaultToolchain), so the dev-shell will evaluate. The lockedmyrev (91afe589) also matches the current main of my-nix-lib, so the two flakes are in sync.Main concern: the PR removes the
packagesoutput entirely. The justfile still defines@build-package: nix build(justfile:20-21) and AGENTS.md still documents "Build viarustPlatform.buildPackageat.nix/pkgs.nix"; with nopackages.<system>.defaultattribute,nix buildnow fails with "flake does not provide attribute 'packages.x86_64-linux.default'". Either restore a package viamy.lib.${system}.rust.mkRustPlatformor 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 setsLD_LIBRARY_PATHfor openssl and addsrust-analyzer), which could matter if any workspace member (e.g.crates/openapi-gen-build) needs build-time openssl headers or pkg-config. Also note themyinput is pinned only by a mutablerefs/heads/mainin the lock — reproducible under--locked, but worth pinning to a rev/tag.*🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: changes
Code review findings from opencode.
@ -54,3 +34,1 @@packages = {default = my-rust-lib;my-rust-lib = my-rust-lib;devShells.default = mkDevShell {[bug] The
packagesoutput (and.nix/pkgs.nix) was removed, sonix buildno longer has a target:packages.<system>.defaultis missing and evaluation fails with "flake does not provide attribute 'packages.x86_64-linux.default'". This breaks the documented build path (just build-packagein justfile:20-21) and contradicts AGENTS.md ("Build viarustPlatform.buildPackageat.nix/pkgs.nix", "verify.yaml: ... Nix build (Cachix push)"). If the package is still intended to be buildable, expose it viamy.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.[style] The old dev-shell explicitly installed
pkg-configandopenssl;mkDevShellfrom my-nix-lib only addsrust-analyzertopackagesand setsLD_LIBRARY_PATHfor openssl (nopkg-config, no openssl dev headers in the environment). This is fine for a no-dependency library, but ifcrates/openapi-gen-buildor future members need build-time openssl/pkg-config,cargo buildinside the shell will fail. Consider passingpackages = [ pkgs.pkg-config pkgs.openssl ]tomkDevShell(a supported parameter) to preserve the old behavior.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 sharedmy-nix-libflake (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.mkDevShellexists andtooltip = "defaultToolchain"is a valid fenix channel attribute — the rustupdefaultprofile — which includes clippy/rustfmt, matching the documented dev shell), nixpkgs is unified viafollows, and the treefmt-nix duplication in flake.lock resolves to the same rev (harmless).The main issues: (1)
my-nix-libonly exposeslib.<system>forx86_64-linuxandaarch64-linux, but this flake evaluates viaflake-utils.eachDefaultSystem(which also includesx86_64-darwin/aarch64-darwin) — on macOSmy.lib.<system>.rustis missing and the flake fails to evaluate; (2) removing thepackagesoutput means barenix buildnow 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.yamland is now further from reality.*🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: changes
Code review findings from opencode.
[style] Pre-existing staleness that this PR makes more inaccurate: the CI section still claims
verify.yamlruns "Build → Test → Clippy (strict) → Nix build (Cachix push)", but.woodpecker/verify.yamlonly 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;[bug]
my.lib.${system}is only defined forx86_64-linuxandaarch64-linuxinmy-nix-lib(itsperSystemiterates those two systems only), but this flake evaluates throughflake-utils.eachDefaultSystem, which also coversx86_64-darwinandaarch64-darwin. On macOS the lookupmy.lib.aarch64-darwin.rustwill be missing and the flake fails to evaluate (brokennix develop/nix flake check). Either iterate only the systemsmy-nix-libsupports (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 {[style] The
packages.default/packages.my-rust-liboutput (previously built via.nix/pkgs.nix) is removed entirely, so barenix buildnow 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 apackages.default = self.checks...or a comment; alternatively re-add it usingmy-nix-lib's crane helpers (mkCraneLib/mkRustPlatform). At minimum, note this in the PR description.