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

Devenv indirectly has itself as Flake input #1122

Open
Cu3PO42 opened this issue Apr 12, 2024 · 3 comments
Open

Devenv indirectly has itself as Flake input #1122

Cu3PO42 opened this issue Apr 12, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Cu3PO42
Copy link
Contributor

Cu3PO42 commented Apr 12, 2024

Hey there! Let me start by thanking you for the work on devenv. Overall I've had a very positive experience with it so far.

However, I have noticed an explosion in Flake inputs when I added it, including many duplicates. I suddenly had six copies of nixpkgs. One of the worst offenders seem to be that one currently gets two copies of devenv by adding it once. This happens because devenv now includes cachix, which itself includes devenv, only a different version. I think adding something along the lines `cachix.inputs.devenv.follows = "self" would make a ton of sense.

More generally, I see no reason for the two not to share their version of flake-compat or pre-commit-hooks, etc.

I'd be happy to send a PR that attempts to remove some of these inputs.

@Cu3PO42 Cu3PO42 added the enhancement New feature or request label Apr 12, 2024
@domenkozar
Copy link
Member

Please send a PR, I'm happy to reduce that set!

@jraygauthier
Copy link

jraygauthier commented Nov 8, 2024

Untangling all of this flake inputs dependency tree so that there are no _2 versions in the flake.lock took me the following:

{
  inputs = {
    nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
    nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";

    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };

    gitignore = {
      url = "github:hercules-ci/gitignore.nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };

    pre-commit-hooks =  {
      url = "github:cachix/pre-commit-hooks.nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        nixpkgs-stable.follows = "nixpkgs-stable";
        flake-compat.follows = "flake-compat";
        gitignore.follows = "gitignore";
      };
    };

    git-hooks = {
      url = "github:cachix/git-hooks.nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        nixpkgs-stable.follows = "nixpkgs-stable";
        flake-compat.follows = "flake-compat";
        gitignore.follows = "gitignore";
      };
    };

    nix = {
      url = "github:domenkozar/nix/devenv-2.21";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-compat.follows = "flake-compat";
      };
    };

    devenv = {
      url = "github:cachix/devenv";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        nix.follows = "nix";
        pre-commit-hooks.follows = "pre-commit-hooks";
        flake-compat.follows = "flake-compat";
        cachix.follows = "cachix";
      };
    };

    cachix = {
      url = "github:cachix/cachix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        git-hooks.follows = "git-hooks";
        flake-compat.follows = "flake-compat";
        devenv.follows = "devenv";
      };
    };
  };
}

Not very user friendly indeed.

@sandydoo
Copy link
Member

sandydoo commented Nov 9, 2024

Not very user friendly indeed.

yeah, welcome to flakes 😄

I recently learned that you can set follows = "", which completely removes the dependency from the lockfile. It's a pain to do, but it's better than doing manual input resolution and lets us remove development/test dependencies, e.g. flake-compat, git-hooks, etc. I started doing it this #1571 and I'd like to extend that to devenv's internal flake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants