Skip to content

nix flake lock does not lock transitive dependencies correctly #8976

@Radvendii

Description

@Radvendii

Describe the bug

When nix flake lock checks whether something needs to be updated, it checks whether the URI has changed. This happens here.

This makes sense for direct dependencies, but for transitive dependencies, we run into trouble. See "steps to reproduce' and "expected behaviour"

Steps To Reproduce
First observe the behaviour on the upstream repository, with relation to the transitive dependency super-upstream

$ git clone https://github.com/radvendii/nix-flake-dep-test-upstream
$ git checkout 27ffa18b5a130873796bb06b8a778b522814774a
$ nix build
$ cat result
super-upstream version: 10b336c
$ git checkout 57c136eb8aacc972553bae8562faf6ac277d5435
$ nix build
$ cat result
super-upstream version: 2d5b244

Note that the only difference between the two git revisions is a run of nix flake update (after super-upstream got a new commit)
Now observe the behaviour on the downstream repository

$ git clone https://github.com/radvendii/nix-flake-dep-test-upstream
$ git checkout 242b12b404e658193e09ccc7f940c9ff03ef7a37
$ nix build
$ cat result
super-upstream version: 10b336c
$ git checkout e6f0d5790f3736a2b7e85b648cecc49f675f63d8
$ nix build
$ cat result
super-upstream version: 10b336c

Here the difference is that I've modified the upstream input uri to point to the second commit above, and run nix flake lock.

Expected behavior

Changing an input and running nix flake lock should check all the transitive dependencies of that input against the upstream lockfile. Those transitive inputs should be considered part of the direct input that is being updated

nix-env --version output
`nix-env (Nix) 2.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions