Skip to content

chore(nix): bump cargo hash and version#162

Open
brhutchins wants to merge 1 commit into
AprilNEA:masterfrom
brhutchins:chore/nix/hash-update
Open

chore(nix): bump cargo hash and version#162
brhutchins wants to merge 1 commit into
AprilNEA:masterfrom
brhutchins:chore/nix/hash-update

Conversation

@brhutchins

Copy link
Copy Markdown

The nix flake wasn't building, because the cargo hash was out of date.

  • Updates cargoHash to present state
  • Updates version to present version
  • Adds cargoDepsName = finalAttrs.pname
    • Without setting the dependencies name to a static value, the hash gets invalidated on every version bump of local crates. This creates a large maintenance surface for the nix flake, because the hash needs to be updated with every change.
    • By setting it to pname, the hash stays valid as long as external dependencies stay consistent, i.e., only actual changes to Cargo.lock will invalidate it.
    • If this were in nixpkgs, it would make sense to retain the default for cargoDepsName and rely on the autobump behaviour; for a local flake, which will always reflect the state of the current branch, minimising hash churn seems like the better option

The nix flake wasn't building, because the cargo hash was out of date.

- Updates `cargoHash` to present state
- Updates `version` to present version
- Adds `cargoDepsName = finalAttrs.pname`
  - Without setting the dependencies name to a static value, the hash
    gets invalidated on every version bump of local crates. This creates
    a large maintenance surface for the nix package, because the hash
    needs to be updated with every single version change.
  - By setting it to `pname`, the hash stays valid as long as external
    dependencies don't change, i.e., only actual changes to `Cargo.lock`
    will invalidate it.
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a broken Nix flake build by updating the cargoHash to reflect the current Cargo.lock state and bumping version to 0.5.3. It also adds cargoDepsName = finalAttrs.pname to pin the vendored-dependencies derivation name to the package name rather than the version, so the hash only needs updating when external Cargo.lock dependencies actually change.

  • version bumped from 0.4.00.5.3 and cargoHash updated accordingly.
  • cargoDepsName = finalAttrs.pname added to stabilise the FOD derivation name across local crate version bumps, reducing maintenance churn for the local flake.

Confidence Score: 5/5

Safe to merge — the changes are confined to the Nix build description and restore a previously broken build.

The diff touches only nix/package.nix: a version string, a hash, and a single attribute that pins the vendored-deps derivation name. All three changes are consistent with the stated goal (fix the broken flake build and reduce future hash churn). The cargoDepsName = finalAttrs.pname pattern is well-understood in Nixpkgs and does not affect the content integrity guarantee of the fixed-output derivation. No application logic, APIs, or runtime behaviour are affected.

No files require special attention.

Important Files Changed

Filename Overview
nix/package.nix Version bumped from 0.4.0 to 0.5.3, cargoHash updated, and cargoDepsName set to pname to decouple the FOD derivation name from the version string — reducing hash churn on local crate version bumps.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[nix build .#openlogi] --> B[rustPlatform.buildRustPackage]
    B --> C{fetchCargoVendor}
    C -->|"cargoDepsName = pname\n(stable: 'openlogi')"| D["FOD: openlogi-vendor\ncargoHash = sha256-HJuE…"]
    D --> E[vendor directory\nwith Cargo deps]
    E --> F[postPatch\nlink gpui-component-assets]
    F --> G[cargo build\n--package=openlogi-gui]
    G --> H[cargo bundle\nOpenLogi.app]
    H --> I[$out/Applications/OpenLogi.app]

    subgraph Before
      X["cargoDepsName = 'openlogi-0.4.0'\n(invalidated on every version bump)"]
    end
    subgraph After
      Y["cargoDepsName = 'openlogi'\n(stable across version bumps)"]
    end
Loading

Reviews (1): Last reviewed commit: "chore(nix): bump cargo hash and version" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant