Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix doesn't recognize removal of flake = false from inputs #8511

Open
shlevy opened this issue Jun 13, 2023 · 2 comments
Open

Nix doesn't recognize removal of flake = false from inputs #8511

shlevy opened this issue Jun 13, 2023 · 2 comments
Assignees

Comments

@shlevy
Copy link
Member

shlevy commented Jun 13, 2023

Describe the bug

When a flake input is locked at flake = false, removing the flake = false setting from the flake.nix does not cause Nix to update the flake lock nor fetch the flake's inputs.

Steps To Reproduce

Given flake.nix:

{
  description = "A very basic flake";

  inputs = {
    iohk-nix = {
      url = "github:input-output-hk/iohk-nix";
      flake = false;
    };
  };

  outputs = { self, nixpkgs }: {

    packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;

    packages.x86_64-linux.default = self.packages.x86_64-linux.hello;

  };
}

flake.lock:

{
  "nodes": {
    "iohk-nix": {
      "flake": false,
      "locked": {
        "lastModified": 1685727458,
        "narHash": "sha256-c/pkFYCfzpRb6W2OOKE+EOzOlcw+96vwJGGg8Ir9Qfk=",
        "owner": "input-output-hk",
        "repo": "iohk-nix",
        "rev": "02f42375ee5c2bab1640f14c6389b7e91bbfec8b",
        "type": "github"
      },
      "original": {
        "owner": "input-output-hk",
        "repo": "iohk-nix",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1686582075,
        "narHash": "sha256-vtflsfKkHtF8IduxDNtbme4cojiqvlvjp5QNYhvoHXc=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "7e63eed145566cca98158613f3700515b4009ce3",
        "type": "github"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "root": {
      "inputs": {
        "iohk-nix": "iohk-nix",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}
  1. Remove flake = false line
  2. Run nix flake lock
  3. If in git, see warning about dirty tree, but flake.lock is unchanged.

Expected behavior

A flake.lock like (this one obtained by removing the entry, locking, then adding the entry and locking):

{
  "nodes": {
    "blst": {
      "flake": false,
      "locked": {
        "lastModified": 1656163412,
        "narHash": "sha256-xero1aTe2v4IhWIJaEDUsVDOfE77dOV5zKeHWntHogY=",
        "owner": "supranational",
        "repo": "blst",
        "rev": "03b5124029979755c752eec45f3c29674b558446",
        "type": "github"
      },
      "original": {
        "owner": "supranational",
        "repo": "blst",
        "rev": "03b5124029979755c752eec45f3c29674b558446",
        "type": "github"
      }
    },
    "iohk-nix": {
      "inputs": {
        "blst": "blst",
        "nixpkgs": "nixpkgs",
        "secp256k1": "secp256k1",
        "sodium": "sodium"
      },
      "locked": {
        "lastModified": 1685727458,
        "narHash": "sha256-c/pkFYCfzpRb6W2OOKE+EOzOlcw+96vwJGGg8Ir9Qfk=",
        "owner": "input-output-hk",
        "repo": "iohk-nix",
        "rev": "02f42375ee5c2bab1640f14c6389b7e91bbfec8b",
        "type": "github"
      },
      "original": {
        "owner": "input-output-hk",
        "repo": "iohk-nix",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1684171562,
        "narHash": "sha256-BMUWjVWAUdyMWKk0ATMC9H0Bv4qAV/TXwwPUvTiC5IQ=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "55af203d468a6f5032a519cba4f41acf5a74b638",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "release-22.11",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1686582075,
        "narHash": "sha256-vtflsfKkHtF8IduxDNtbme4cojiqvlvjp5QNYhvoHXc=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "7e63eed145566cca98158613f3700515b4009ce3",
        "type": "github"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "root": {
      "inputs": {
        "iohk-nix": "iohk-nix",
        "nixpkgs": "nixpkgs_2"
      }
    },
    "secp256k1": {
      "flake": false,
      "locked": {
        "lastModified": 1683999695,
        "narHash": "sha256-9nJJVENMXjXEJZzw8DHzin1DkFkF8h9m/c6PuM7Uk4s=",
        "owner": "bitcoin-core",
        "repo": "secp256k1",
        "rev": "acf5c55ae6a94e5ca847e07def40427547876101",
        "type": "github"
      },
      "original": {
        "owner": "bitcoin-core",
        "ref": "v0.3.2",
        "repo": "secp256k1",
        "type": "github"
      }
    },
    "sodium": {
      "flake": false,
      "locked": {
        "lastModified": 1675156279,
        "narHash": "sha256-0uRcN5gvMwO7MCXVYnoqG/OmeBFi8qRVnDWJLnBb9+Y=",
        "owner": "input-output-hk",
        "repo": "libsodium",
        "rev": "dbb48cce5429cb6585c9034f002568964f1ce567",
        "type": "github"
      },
      "original": {
        "owner": "input-output-hk",
        "repo": "libsodium",
        "rev": "dbb48cce5429cb6585c9034f002568964f1ce567",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

nix --version output

nix (Nix) 2.16.1

Additional context

Add any other context about the problem here.

Priorities

Add 👍 to issues you find important.

@shlevy shlevy added the bug label Jun 13, 2023
@edolstra edolstra self-assigned this Jun 16, 2023
@shlevy
Copy link
Member Author

shlevy commented Jun 16, 2023

This seems to also impact recursive updates: If A depends on B, and B has a flake = false dependency on C, then I update B to have a flake = true dependency on C, then updating A's dependency on B requires removing and re-adding B (Otherwise I get an error like "input 'iogx/iohk-nix' has an override for a non-existent input 'nixpkgs'")

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-06-16-nix-team-meeting-minutes-63/29316/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏁 Review
Development

No branches or pull requests

4 participants