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

add --extra-nixpkgs-config #315

Merged
merged 4 commits into from
Mar 16, 2023
Merged

add --extra-nixpkgs-config #315

merged 4 commits into from
Mar 16, 2023

Conversation

figsoda
Copy link
Collaborator

@figsoda figsoda commented Feb 27, 2023

closes #314

README.md Outdated Show resolved Hide resolved
@SomeoneSerge
Copy link

SomeoneSerge commented Feb 27, 2023

Is there anything to be done with list_packages?

def list_packages(
path: str,
system: str,
allow: AllowedFeatures,
check_meta: bool = False,
) -> List[Package]:
cmd = [
"nix-env",
"--extra-experimental-features",
"" if allow.url_literals else "no-url-literals",
"--option",
"system",
system,
"-f",
path,

Maybe it's easier to implement --nixpkgs-option config { allowUnfree = true; } than --extra-nixpkgs-config { config.allowUnfree = true; }, because it maps directly into the already familiar nix-env's --arg or --option

@figsoda
Copy link
Collaborator Author

figsoda commented Feb 27, 2023

I'm not sure. There are a few things we can do

  • use --extra-nixpkgs-config and do nothing to nix-env (what we are doing right now)
  • use --extra-nixpkgs-arg (and --extra-nixpkgs-argstr) instead, similar to nix-env's --arg and --argstr
  • use --extra-nixpkgs-config and pass it to nix-env (with -E?)

@SomeoneSerge
Copy link

SomeoneSerge commented Feb 27, 2023

IIUC, we need either of the last two options, otherwise review.differences will miss the affected attributes. Either is good, and I don't know which is easier to maintain

@Mic92
Copy link
Owner

Mic92 commented Feb 28, 2023

I will skip reviewing this feature but I think we should have some way of passing nixpkgs configuration into nixpkgs-review. Just merge if you come to a consensus @SuperSandro2000 @figsoda

pkgs = import <nixpkgs> ({
config = {
checkMeta = true;
allowUnfree = true; inherit allowAliases;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If extra-nixpkgs-config contains config as an attribute, we're going to loose allowUnfree. We either need a recursive merge or we stick to --nixpkgs-arg[str] instead

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's another bit, I think:

self.nixpkgs_config = NamedTemporaryFile()
self.nixpkgs_config.write(
str.encode(
f"""{{
allowUnfree = true;
allowBroken = true;

@SomeoneSerge
Copy link

Here's a preview of the current status: https://gist.github.com/SomeoneSerge/745681c4d577fac2b2e71b6349cc2503 with this quick solution to differences(): SomeoneSerge@9c3c9fe

At a glance, I think the list of packages looks good

@Mic92
Copy link
Owner

Mic92 commented Mar 1, 2023

When this PR is merged I will make a new release.

@figsoda
Copy link
Collaborator Author

figsoda commented Mar 1, 2023

One issue I have currently is that nix-env doesn't do recursive updates. Would any config change the outputs of nix-env? I'm thinking we should just ignore nix-env and implement recursive updates for the regular eval I think we should go with --extra-nixpkgs-config instead so we don't have to handle multiple arguments

@figsoda figsoda marked this pull request as ready for review March 1, 2023 21:43
@figsoda figsoda requested review from SomeoneSerge and SuperSandro2000 and removed request for SomeoneSerge March 1, 2023 21:47
@SomeoneSerge
Copy link

SomeoneSerge commented Mar 1, 2023

I think (I hope) I'm observing some false-positive "updates": https://gist.github.com/SomeoneSerge/6cc00b41964e43f725fc12046778532d Sorry, it works alright, just accidentally opened a portal to hell. I'll run without global cudaSupport and post again when it's over

@SomeoneSerge
Copy link

Is it expect behaviour that nixpkgs-review pr doesn't always print the "X packages updated" part? E.g. here it didn't mention nix-env and just went ahead to nix build: https://gist.github.com/5c5ceccb1add211d551a9813ef8be960

@figsoda
Copy link
Collaborator Author

figsoda commented Mar 2, 2023

It is expected I believe: e704d6a

Copy link

@SomeoneSerge SomeoneSerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current version works for me (example: NixOS/nixpkgs#218265 (comment)) and I'm happy with the UX. I find it confusing that for some PRs the tool doesn't show in advance which packages it's going to build, but I'm not even sure if it's related to this change. The rest is in Sandro's scope, I suppose:)

README.md Show resolved Hide resolved
@figsoda
Copy link
Collaborator Author

figsoda commented Mar 9, 2023

@SuperSandro2000

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
@figsoda
Copy link
Collaborator Author

figsoda commented Mar 16, 2023

bors r+

I messaged sandro privately. He is currently prioritizing on other things and is not against merging this

@bors
Copy link
Contributor

bors bot commented Mar 16, 2023

Build succeeded:

@bors bors bot merged commit 0bc0395 into Mic92:master Mar 16, 2023
@figsoda figsoda deleted the extra branch March 16, 2023 17:21
@bobby285271 bobby285271 mentioned this pull request Mar 29, 2023
12 tasks
@nviets
Copy link

nviets commented Jun 16, 2023

Can I use this argument to cap resources with max-jobs and cores? By default nixpkgs-review tries to build with everything.

@SuperSandro2000
Copy link
Collaborator

You want to set those settings in your nix.conf.

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

Successfully merging this pull request may close these issues.

Allow passing extra arguments to import <nixpkgs>
5 participants