Monorepo for Tangled tangled.org

Pinning dependency versions in Spindle #347

closed
opened by cuducos.me

I am a noobie in Nix world, and I am wondering if it is possible to pin dependency versions in Spindle. For example:

dependencies:
  nixpkgs:
    - go

This block above works just fine, but I have zero control over the version of Go running in the CI.

dependencies:
  nixpkgs:
    - go@1.25.0

That option breaks the whole thing (nothing in the pipeline runs).

I am wondering whether I am doing something obviously wrong (high probability lol) or… maybe pinning dependency versions is not supported (yet).

nixpkgs has different versions of the go compiler, the package you'd be looking for specifically would be go_1_25. for several reasons, nixpkgs does not version every package (the goal is to offer a set of packages that work with each other! so depending on a certain copy of a package without upgrading the rest could break that guarantee).

so, we support custom nixpkgs pins using the "registries" feature. this portion of the docs might be useful. for example, if you are looking to get an exact version of a tool, say python-3.11.3, you can find the nixpkgs revision that included this using nixhub (https://www.nixhub.io/packages/python), which happens to be 932fc16b263f26803d3960e4400bc13dde84a972, and then, you can add this pin of nixpkgs to your dependencies:

dependencies:
  # nixpkgs
  nixpkgs:
    - nodejs
    - go
  # custom registry
  git+https://github.com/nixos/nixpkgs/932fc16b263f26803d3960e4400bc13dde84a972:
    - python3

note that the go compiler specifically has an interesting interaction with go modules, where it downloads the newer toolchain if you have the go XXX directive in your go.mod file: https://go.dev/ref/mod#go-mod-file-go.

Thank you, @oppi.li! That helps a lot : )

sign up or login to add to the discussion
Labels

None yet.

area

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:3272gdrjsuikiff7qsgokgas/sh.tangled.repo.issue/3majpkm72h422