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

Suggestion: catch repo = pname usage #21

Open
hughobrien opened this issue Jul 3, 2023 · 2 comments
Open

Suggestion: catch repo = pname usage #21

hughobrien opened this issue Jul 3, 2023 · 2 comments

Comments

@hughobrien
Copy link

hughobrien commented Jul 3, 2023

Arising from a discussion here

repo = pname is nice for DRY but probably creates a binding that goes too far.

I suggest detecting when repo is anything other than a string literal.

Thanks for this project!

@drupol
Copy link

drupol commented Jul 3, 2023

I fully agree with this.

I'm going to use this issue as a justification for people asking why they can't use a variable for the repo attribute.

The reason is that changing the pname of a derivation shouldn't change the src attribute.

Bad

stdenv.mkDerivation (finalAttrs: {
  pname = "foobar";

  src = fetchFromGitHub {
    owner = "xxx";
    repo = finalAttrs.pname;
    rev = "zzz";
    hash = "sha256-abcd";
  };
})

Good

stdenv.mkDerivation (finalAttrs: {
  pname = "foobar";

  src = fetchFromGitHub {
    owner = "xxx";
    repo = "foobar";
    rev = "zzz";
    hash = "sha256-abcd";
  };
})

@SuperSandro2000
Copy link
Member

Especially more concerning is finalAttrs.pname

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

No branches or pull requests

3 participants