cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.47k stars 252 forks source link

Secondary inputs are not locked according to their parent input #1141

Open Hamled opened 2 weeks ago

Hamled commented 2 weeks ago

Describe the bug When devenv needs to update an input either because it was added to devenv.yaml or the devenv update command was run, the "secondary" inputs of that input are not always locked in the same way that they are in their parent input's flake.lock.

Apologies for the confusing phrasing, I don't really understand the best terminology to use here.

To reproduce

  1. devenv init
  2. devenv inputs add nixpkgs-python github:cachix/nixpkgs-python

Running the above commands at the time of filing this issue, the following is created in devenv.lock (full set of files):

{
  "nodes": {
    // snip...
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1713145326,
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e",
        "treeHash": "bb82f3be89ba64ef34820189f66e3054cfc4bafd",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-23.11",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    // snip...
  },
  "root": "root",
  "version": 7
}

Revision 53a2c32bc66f5ae41a28d7a9a49d321172af621e is the current HEAD of the nixos-23.11 branch, however the referenced version of the flake.lock file in nixpkgs-python uses a different revision.

When creating a new project with nix flake init and manually adding inputs.nixpkgs-python.url = "github:cachix/nixpkgs-python"; the revision used for the nixpkgs-python.inputs.nixpkgs node in the lock file is the same as from the input's flake lock.

Additionally, if a particular revision for the "secondary" input is in the lock file when devenv update is run, it gets updated to the latest revision in the same way as when the input was originally added. When using nix flake update this does not happen.

Version

devenv 1.0.4 (x86_64-linux)