Skip to content

Conversation

Trivaris
Copy link

Nix: factor out system, format Nix, and refresh pnpm hashes

Changes

  • Factor out system = "x86_64-linux" and reuse it across flake.nix:
    • Use ${system} for packages and devShells.
    • Pass inherit system into the overlay.
  • Apply nixfmt-rfc-style formatting across Nix files and minor tidy-ups:
    • Normalize function argument spacing and remove an unused parameter.
  • Refresh pnpm.fetchDeps content-addressed hashes in:
    • nix/assets.nix
    • nix/typescript/shims.nix

Rationale

  • Single source of truth for the target system ⇒ easier future updates and less duplication
  • Formatting improves readability and consistency
  • Updated hashes fix current fetch/build failures and preserve reproducibility

Scope / Risk

  • No runtime/product changes; Nix packaging only
  • Overlay behavior unchanged aside from reading system from a single place

@shdwmtr
Copy link
Member

shdwmtr commented Sep 1, 2025

@Sk7Str1p3

@DrymarchonShaun
Copy link

DrymarchonShaun commented Sep 4, 2025

This and #487 are partially redundant

EDIT: actually they might not be, the hashes do seem to be different.

@Neubulae
Copy link

Neubulae commented Sep 6, 2025

error: hash mismatch in fixed-output derivation '/nix/store/g6ldv87lnp0ckyml7s8p1h4xl1zxga1w-millennium-assets-pnpm-deps.drv':
           likely URL: (unknown)
            specified: sha256-/H3Np/FjxEdU/TwqPPJlpNti2vfyNqUQ2CNIvzlSemA=
                  got: sha256-nDSltpFQRM9loVuDour4OrRdN22/A7MkZTGAtL0x7rU=
        expected path: /nix/store/9zb9wi9a3cqjnj51723bxcka5ndcyxzf-millennium-assets-pnpm-deps
             got path: /nix/store/znh3m89jq1qmfz4jq84b0gzdqm46ic2j-millennium-assets-pnpm-deps

manually trying this PR out gave me this very dumbfounding message, I am all weirded out

@DrymarchonShaun
Copy link

error: hash mismatch in fixed-output derivation '/nix/store/g6ldv87lnp0ckyml7s8p1h4xl1zxga1w-millennium-assets-pnpm-deps.drv':
           likely URL: (unknown)
            specified: sha256-/H3Np/FjxEdU/TwqPPJlpNti2vfyNqUQ2CNIvzlSemA=
                  got: sha256-nDSltpFQRM9loVuDour4OrRdN22/A7MkZTGAtL0x7rU=
        expected path: /nix/store/9zb9wi9a3cqjnj51723bxcka5ndcyxzf-millennium-assets-pnpm-deps
             got path: /nix/store/znh3m89jq1qmfz4jq84b0gzdqm46ic2j-millennium-assets-pnpm-deps

manually trying this PR out gave me this very dumbfounding message, I am all weirded out

It looks like the updated hash in this PR isn't correct. @Trivaris if you want, I can pull the changes to system into #487 and this can be closed

@Trivaris
Copy link
Author

Trivaris commented Sep 6, 2025

nix build .#millennium
nix build .#

will compile successfully on the nix-update branch and does not result in any errors, I could not reproduce what youre experiencing?

Im currently using my fork as a flake input to my nixos configuration and it works perfectly fine

@Trivaris
Copy link
Author

Trivaris commented Sep 6, 2025

I did at some point accidentally sync my fork with the upstream repo, but reversed that immediatly, thought this pull request seems to still have that commit, im getting on that right now

@DrymarchonShaun
Copy link

DrymarchonShaun commented Sep 6, 2025

shaun@natrix ~/.s/Millennium (pr/490)> nix build .#millennium
error: build of '/nix/store/g6ldv87lnp0ckyml7s8p1h4xl1zxga1w-millennium-assets-pnpm-deps.drv' on 'ssh-ng://nix-ssh@getula' failed: hash mismatch in fixed-output derivation '/nix/store/g6ldv87lnp0ckyml7s8p1h4xl1zxga1w-millennium-assets-pnpm-deps.drv':
         specified: sha256-/H3Np/FjxEdU/TwqPPJlpNti2vfyNqUQ2CNIvzlSemA=
            got:    sha256-nDSltpFQRM9loVuDour4OrRdN22/A7MkZTGAtL0x7rU=
error: builder for '/nix/store/g6ldv87lnp0ckyml7s8p1h4xl1zxga1w-millennium-assets-pnpm-deps.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/fvnldx91q5a3yx65kk27zrk9a6a10bj4-millennium-assets-git.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pfxgrxbihh0q2jzhr7brk6hqg53i7bdl-millennium-git.drv' failed to build

I'm getting the same error @Neubulae reported

EDIT: or effectively the same, at least

@Trivaris
Copy link
Author

Trivaris commented Sep 6, 2025

I removed the failing commit, the builds still pass on my end, but what I suspect is happening is that at some point the pnpm dependencies are changed to different versions of themselves, be it by using already installed versions or the upstream repo updating it, which results in a different hash, which is causing that error.

@DrymarchonShaun
Copy link

I'm slightly confused now, whatever change you just made doesn't fix the build error, the hash you have for the .#assets package is still incorrect and causing a build failure.

@Trivaris
Copy link
Author

Trivaris commented Sep 6, 2025

Millennium on  nix-update via △ 
❯ nix build .#millennium
Millennium on  nix-update via △ took 3s 
❯ nix build .#
Millennium on  nix-update via △ took 3s 
❯ nix build .#assets
Millennium on  nix-update via △ took 3s 
❯ 

I didn't change anything per se, I just rolled back a sync of the upstream repo, which updated the dependencies, thus changing the hashes. On my end the builds are still passing and I do not know what else would or could change that

Though we can do what you suggested here and split these concerns into different prs,

error: hash mismatch in fixed-output derivation '/nix/store/g6ldv87lnp0ckyml7s8p1h4xl1zxga1w-millennium-assets-pnpm-deps.drv':
           likely URL: (unknown)
            specified: sha256-/H3Np/FjxEdU/TwqPPJlpNti2vfyNqUQ2CNIvzlSemA=
                  got: sha256-nDSltpFQRM9loVuDour4OrRdN22/A7MkZTGAtL0x7rU=
        expected path: /nix/store/9zb9wi9a3cqjnj51723bxcka5ndcyxzf-millennium-assets-pnpm-deps
             got path: /nix/store/znh3m89jq1qmfz4jq84b0gzdqm46ic2j-millennium-assets-pnpm-deps

manually trying this PR out gave me this very dumbfounding message, I am all weirded out

It looks like the updated hash in this PR isn't correct. @Trivaris if you want, I can pull the changes to system into #487 and this can be closed

What I will say though is that automatically updating the hashes does kind of go against nix's philosophy of perfectly reproducible builds, as it depends on outside variables and that change would make this flake impure

EDIT: Sorry, I misunderstood the purpose of that script, its perfectly fine, sorry

@DrymarchonShaun
Copy link

EDIT: Sorry, I misunderstood the purpose of that script, its perfectly fine, sorry

all good, I'm not 100% sure it's functioning properly atm.

Millennium on  nix-update via △ 
❯ nix build .#millennium
Millennium on  nix-update via △ took 3s 
❯ nix build .#
Millennium on  nix-update via △ took 3s 
❯ nix build .#assets
Millennium on  nix-update via △ took 3s 
❯

What happens if you change the version of each (or at least the assets) package definition(s) to a different (arbitrary) string? I think you already have the pnpmDeps cached in your nix store and because the version is hardcoded to 'git' nix isn't even trying to redownload them, so it isn't telling you the hash is wrong because it isn't checking it.

@shdwmtr
Copy link
Member

shdwmtr commented Sep 6, 2025

The Nix maintainer on Millennium is very inactive, and I don't use Nix, nor do I know anything about it.
If anything needs to be changed someone let me know what exactly should be merged/not merged.

@Trivaris
Copy link
Author

Moved to #487

@Trivaris Trivaris closed this Sep 11, 2025
@Trivaris Trivaris deleted the nix-update branch September 11, 2025 14:05
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.

5 participants