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

nixos/nixosSystem: Remove deprecated arguments, deprecate pkgs argument, and add errors to specialArgs #247448

Closed
wants to merge 3 commits into from

Conversation

Gerg-L
Copy link
Contributor

@Gerg-L Gerg-L commented Aug 6, 2023

Description of changes

passing pkgs to specialArgs and lib.nixosSystem is a common anti-pattern that new users fall into which causes unexpected behavior and complete ignorance to the nixpkgs. option set

Since readOnlyPkgs has merged there's a easy immutable way to set pkgs

I think it's time to do away with alternative handling methods of pkgs

opinions are appreciated, thanks

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Aug 6, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Aug 6, 2023
@github-actions github-actions bot added the 8.has: module (update) This PR changes an existing module in `nixos/` label Aug 6, 2023
@Gerg-L Gerg-L marked this pull request as ready for review August 6, 2023 23:30
@Gerg-L Gerg-L requested a review from infinisil as a code owner August 6, 2023 23:30
@Gerg-L
Copy link
Contributor Author

Gerg-L commented Aug 6, 2023

TODO: add documentation

@infinisil infinisil requested a review from roberth August 7, 2023 00:25
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

  • A bit too aggressive on the stable api.
  • Secondarily: don't tolerate error conditions with just a warning.

Also seems like a good idea to finish #231940 before triggering deployment tool maintainers to look at their nixpkgs.* situation.

++
(optional (pkgs_ != null) {
_module.args.pkgs = lib.mkForce pkgs_;
})
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't change the behavior with just a warning, and I feel like this is too big a change anyway - as this is the stable NixOS entrypoint.

How about we start with removing pkgs from lib.nixosSystem? That's a weird one, where it's unclear what the intent should even be: ignore nixpkgs.*? Use readOnlyPkgs? I think both are equally surprising and users should make a choice (if they pass pkgs at all).

Copy link
Contributor Author

@Gerg-L Gerg-L Aug 7, 2023

Choose a reason for hiding this comment

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

Yeah that should either be changed to a error or added back

I think specialArgs should at least have a warning saying it can potentially be harmful

@Gerg-L
Copy link
Contributor Author

Gerg-L commented Aug 7, 2023

I mostly agree with you roberth

Mainly put this out there to get opinions

This should definitely merge after #231940

@github-actions github-actions bot removed the 8.has: module (update) This PR changes an existing module in `nixos/` label Aug 7, 2023
@Gerg-L Gerg-L changed the title nixos: Deprecate passing pkgs to specialArgs and lib.nixosSystem nixos/nixosSystem: Remove deprecated arguments, deprecate pkgs argument, and add errors to specialArgs Aug 7, 2023
@Gerg-L
Copy link
Contributor Author

Gerg-L commented Dec 10, 2023

i'll make a similar PR later

@Gerg-L Gerg-L closed this Dec 10, 2023
@Gerg-L Gerg-L deleted the nixosSystem branch March 2, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants