Skip to content

Add a fourth hint for nix run - #117842

Closed
waxlamp wants to merge 3 commits into
NixOS:masterfrom
waxlamp:nix-run-error-message
Closed

waxlamp wants to merge 3 commits into
NixOS:masterfrom
waxlamp:nix-run-error-message

Conversation

@waxlamp

@waxlamp waxlamp commented Mar 27, 2021 •

Copy link
Copy Markdown
Motivation for this change

Attempting to run postman via nix run nixpkgs#postman, I got an error message about unfree packages, but the mitigations listed weren't helping. With some discussion from this discourse topic, I understood that I needed the --impure flag, but the error message does not mention that.

This PR just adds a bit of text to that error message block about instituting one of the recommended fixes, then making sure to use --impure with nix run.

I am not sure how to test this change; some help with that would be appreciated.

Closes #116340.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@github-actions github-actions Bot added the 6.topic: stdenv Standard environment label Mar 27, 2021
@ofborg ofborg Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Mar 27, 2021
Comment thread pkgs/stdenv/generic/check-meta.nix Outdated
Comment on lines +137 to +138
d) If you are using `nix run`, in addition to one of the fixes above, you
may need to use the `--impure` flag as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
d) If you are using `nix run`, in addition to one of the fixes above, you
may need to use the `--impure` flag as well.
d) If you are using nix unstable commands, in addition to one of the fixes above, you
may need to use the `--impure` flag as well.

Not sure the best way to word that, but this applies to build, run, shell and other unstable commands.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is that part of nix-command or flakes experimental feature?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure, one of them makes all evaluation pure by default. I think its flakes experimental feature. But usually you enable both, so I don't know.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry for the delay, @Pacman99, and thank you for the review.

I tried to make the information more comprehensive (ade15a5), but I also don't know the answer to @SuperSandro2000's question, so am not totally sure how best to phrase it. Please take a look at my update and let me know what you think.

Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I consider the examples problematic, run and build exist for 2.3 as well, and shell also IIRC.

Can't you say "in a pre release version of nix"?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@NobbZ, could you maybe provide some example wording? I'm not sure how to update the text to resolve your concerns.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"If you are using a prerelease version of nix (eg. flake enabled), you need to use the --impure flag in combination with solution a) or c)"

@Pacman99 Pacman99 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like the new wording, this looks good. Also this closes #116340, so it would be good to link that in the PR.

@waxlamp

waxlamp commented Jun 23, 2021

Copy link
Copy Markdown
Author

@Pacman99, what else should I do to get this ready for merge?

@nixos-discourse

Copy link
Copy Markdown

Comment thread pkgs/stdenv/generic/check-meta.nix Resolved
@colemickens

colemickens commented Jun 23, 2021 •

Copy link
Copy Markdown
Member

I don't like this change. I'd much rather see this warning instruct people on how to do the right thing with pure-eval, rather than just encouraging more indirect overriding of internal behavior.

I can see it now - someone will do this and then wind up including more impurity than they'd wanted to and then being confused why allowing unfree with --impure is somehow causing overlays to be loaded, etc.

@waxlamp

waxlamp commented Jul 11, 2021

Copy link
Copy Markdown
Author

I don't like this change. I'd much rather see this warning instruct people on how to do the right thing with pure-eval, rather than just encouraging more indirect overriding of internal behavior.

I can see it now - someone will do this and then wind up including more impurity than they'd wanted to and then being confused why allowing unfree with --impure is somehow causing overlays to be loaded, etc.

I'm getting a lot of conflicting advice on this PR and would like some help in knowing which direction is best for everyone. For my part, I found the existing help text to be both unhelpful and, after diving into things, inaccurate, so I was trying to improve both aspects in the way that minimally made me able to function.

I'm not aware in general of how to "do the right thing with pure-eval"; would you mind pointing me towards some resources that explain it? Related request: would you mind prompting me towards what sort of help text you think would be better?

If we could form some consensus on this, I think that would be great. As it stands, I don't have enough knowledge to understand how best to improve the error message here.

Thanks everyone!

@NobbZ

NobbZ commented Jul 12, 2021

Copy link
Copy Markdown
Contributor

The "right" thing, is often considered a wrapping flake, that imports nixpkgs with an appropriate config and re-exposes all of nixpkgs package set.

This is something I do not like though, as it requires a lot of work, especially if you want to have some certain commit of nixpkgs or use different branches all the time…

--impure + env-vars is in my opinion usually the easiest and quickest way to test something broken/unfree without having to enable the setting in config/rebuild/switch/rollback on misbehave…

@waxlamp

waxlamp commented Aug 14, 2021

Copy link
Copy Markdown
Author

The "right" thing, is often considered a wrapping flake, that imports nixpkgs with an appropriate config and re-exposes all of nixpkgs package set.

This is something I do not like though, as it requires a lot of work, especially if you want to have some certain commit of nixpkgs or use different branches all the time…

--impure + env-vars is in my opinion usually the easiest and quickest way to test something broken/unfree without having to enable the setting in config/rebuild/switch/rollback on misbehave…

This confirms my own intuition: the "right thing" is some deeper action that is bulky to perform and requires a lot of understanding of theory; the thing that lets me continue being productive in my environment immediately is using the --impure flag.

@waxlamp

waxlamp commented Aug 14, 2021

Copy link
Copy Markdown
Author

@jonringer, thanks again for your input on the help text. I am not sure what else to do to get this reviewed and merged. Can you help push this along?

@stale

stale Bot commented Apr 18, 2022

Copy link
Copy Markdown

I marked this as stale due to inactivity. → More info

@stale stale Bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 18, 2022
@nixos-discourse

Copy link
Copy Markdown

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

https://discourse.nixos.org/t/prs-ready-for-review/3032/2118

@stale stale Bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 23, 2023
@SuperSandro2000

Copy link
Copy Markdown
Member

Similar thing was already done in 7bea56b

@Janik-Haag Janik-Haag added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: stdenv Standard environment 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

help text for unfree outdated (and wrong)

8 participants