Skip to content

system-path: Remove defaultPackages option#263295

Open
l0b0 wants to merge 1 commit intoNixOS:masterfrom
l0b0:chore/clean-up-environment-default-packages
Open

system-path: Remove defaultPackages option#263295
l0b0 wants to merge 1 commit intoNixOS:masterfrom
l0b0:chore/clean-up-environment-default-packages

Conversation

@l0b0
Copy link
Contributor

@l0b0 l0b0 commented Oct 25, 2023

Description of changes

None of these tools are necessary for a minimal system.

Closes #263289.

@ofborg test disable-installer-tools

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added Modified a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@l0b0 l0b0 requested a review from samueldr as a code owner October 25, 2023 07:33
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes 8.has: module (update) This PR changes an existing module in `nixos/` labels Oct 25, 2023
@l0b0 l0b0 requested a review from K900 October 25, 2023 07:34
@l0b0
Copy link
Contributor Author

l0b0 commented Oct 25, 2023

@ofborg test installer installer-systemd-stage-1 disable-installer-tools

@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Oct 25, 2023
@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 25, 2023
@delroth delroth added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Oct 25, 2023
@nikstur nikstur mentioned this pull request Oct 25, 2023
13 tasks
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.

You'd be responsible for others' data loss because their backup script stopped working, as rsync disappeared.

We can't silently remove packages, and I don't think doing it loudly (whatever that is) is worth the annoyance for something as minor as this.

defaultPackages' purpose iirc is exactly to be able to opt out of these packages without breaking existing configurations.

@roberth
Copy link
Member

roberth commented Oct 26, 2023

Fyi, a possible replacement for defaultPackages could be

It also allows users to remove packages, without breaking existing configs.

@l0b0
Copy link
Contributor Author

l0b0 commented Oct 27, 2023

You'd be responsible for others' data loss because their backup script stopped working, as rsync disappeared.

Assuming they don't have any notification in place, and that nothing else installs rsync. But I agree, this is a concern. I still think it's really bad to install several effectively random and rarely used packages on every single NixOS instance.

We can't silently remove packages, and I don't think doing it loudly (whatever that is) is worth the annoyance for something as minor as this.

I wouldn't consider wasting however many cycles and bytes are needed for these packages millions or billions of times over "minor".

defaultPackages' purpose iirc is exactly to be able to opt out of these packages without breaking existing configurations.

The "opt out" is the problem here. I haven't seen any reason that any of these should be default, any more than Firefox, netcat, jq, or any of the thousands of available programs. And it's not exactly obvious to a beginner why this is necessary or how to do it.

@l0b0
Copy link
Contributor Author

l0b0 commented Oct 27, 2023

Fyi, a possible replacement for defaultPackages could be

* [nixos/system-path: convert environment.systemPackages to an attrset #255086](https://github.com/NixOS/nixpkgs/pull/255086)

It also allows users to remove packages, without breaking existing configs.

That would be cool, but it's very far from ready, and we should still address the issue of installing packages which usually don't need to be there.

@l0b0 l0b0 force-pushed the chore/clean-up-environment-default-packages branch from f26ab2e to c8e0076 Compare October 27, 2023 07:42
@roberth
Copy link
Member

roberth commented Oct 27, 2023

I agree that it's bad, but in my opinion the cure is worse.

At the very least, you should add a proper release note that describes what actually happens to people's configs.
(The changed line doesn't mean much to hardly anyone)

Maybe I'm wrong. Maybe others agree it's good enough? Feel free to discuss with others and reach a decision.

EDIT: ping me if you need me.

@roberth roberth dismissed their stale review October 27, 2023 08:43

Letting others decide.

@xaverdh
Copy link
Contributor

xaverdh commented Oct 27, 2023

As I mentioned here, the original idea behind defaultPackages was to gradually absorb things from requiredPackages one by one (checking that things do not break without them), allowing for them to be disabled by overriding defaultPackages and at the same time not breaking peoples setup (because they are still there by default).

@delroth delroth removed the 12.approvals: 2 This PR was reviewed and approved by two persons. label Oct 27, 2023
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
@jaredmontoya
Copy link
Contributor

jaredmontoya commented Aug 23, 2024

Backwards compatibility is important but I don't want this to become another fgrep/egrep that is deprecated yet never removed.

is perl of all thing an integral part of nixos?
And if there is no dependency on rsync or strace by Nix or NixOS then they shouldn't be included by default, if someone really wants to use rsync or strace or even perl then they will include it in the nix config, that's the point of using NixOS, having a reproducible and tailored to your needs system, isn't it?

I don't think such minor breaking changes are bad because they are VERY TRIVIAL to fix(literally move 3 lines of code) unlike some other changes that make you reimplement what you already did again but in a completely different way that you have to learn.
And if the config just simply won't build because the option is gone then this:

You'd be responsible for others' data loss because their backup script stopped working, as rsync disappeared.

won't happen.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 23, 2024
@eclairevoyant
Copy link
Contributor

eclairevoyant commented Aug 26, 2024

And if the config just simply won't build because the option is gone

To be clear, that's not really the main scenario to care about when it comes to defaults, they're called default for a reason. The scenario to care about is those who didn't put rsync into their configs because it was already included in the base system (and who aren't using the rsyncd module, I suppose) - or the analogous equivalent for other default packages.

@jaredmontoya
Copy link
Contributor

The scenario to care about is those who didn't put rsync into their configs because it was already included in the base system

If we really care a lot, then this change can be locked behind a state version, because changing it means you give consent to breaking changes.

And if we don't want to bloat NixOS code with state version checks that keep legacy code, then this change can be just another major release breaking change, people that upgrade from one major NixOS version to another also give their consent to breaking changes and should read release notes.

Although having perl of all things installed by default is not something that needs to be removed ASAP or else the user experience is ruined, I still don't want to see it be installed by default in 5 years despite it not being a dependency.

@l0b0 l0b0 force-pushed the chore/clean-up-environment-default-packages branch from c8e0076 to 93e7c46 Compare August 26, 2024 12:16
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 26, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 10, 2024
@nixpkgs-ci nixpkgs-ci bot added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 12.approvals: 2 This PR was reviewed and approved by two persons. labels Jun 25, 2025
@SuperSandro2000
Copy link
Member

Can you give this one a rebase? I think we should finally remove this option.

@nixpkgs-ci nixpkgs-ci bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 8, 2025
@l0b0 l0b0 force-pushed the chore/clean-up-environment-default-packages branch 2 times, most recently from a21b746 to 3e89c24 Compare September 8, 2025 20:29
@l0b0
Copy link
Contributor Author

l0b0 commented Sep 8, 2025

Can you give this one a rebase? I think we should finally remove this option.

Done! It was mentioned a few more places, so I've cleaned those out as well.

None of these tools are necessary for a minimal system.

Closes NixOS#263289.
@l0b0 l0b0 force-pushed the chore/clean-up-environment-default-packages branch from 3e89c24 to a94b7d2 Compare September 8, 2025 20:32
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 8, 2025
@nix-owners nix-owners bot requested a review from ElvishJerricco September 8, 2025 20:38
@l0b0
Copy link
Contributor Author

l0b0 commented Sep 8, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 263295
Commit: a94b7d27761d6be5e9a6babf3215849809ef4d2d


x86_64-linux

⏩ 2 packages blacklisted:
  • nixos-install-tools
  • tests.nixos-functions.nixos-test
❌ 1 package failed to build:
  • tests.devShellTools.nixos
✅ 4 packages built:
  • tests.testers.lycheeLinkCheck.network
  • tests.testers.nixosTest-example
  • tests.testers.runNixOSTest-example (tests.testers.runNixOSTest-extendNixOS)
  • tests.trivial-builders.references

Error logs: `x86_64-linux`
tests.devShellTools.nixos
docker # Adding manifests...
docker # Done.
docker # [  269.260884] dockerd[878]: time="2025-09-08T20:43:43.771578340Z" level=info msg="Layer sha256:a3f35910ea90c05594581fa87a35e4a4a5aab400ddf69ad7f79ed6b1e1c9a0ac cleaned up"
docker # [  269.265244] dockerd[878]: time="2025-09-08T20:43:43.776303801Z" level=info msg="Layer sha256:d07f16e20f117aa6116cacb42311c7af4095c20c1dd330bbd60ef284d88a19ac cleaned up"
docker # [  269.267946] dockerd[878]: time="2025-09-08T20:43:43.779020627Z" level=info msg="Layer sha256:7db6d8a15d22947a2aad21cbbb90d1a43c9de6610426e213a7409410df8e40a2 cleaned up"
docker # [  269.270636] dockerd[878]: time="2025-09-08T20:43:43.781649173Z" level=info msg="Layer sha256:48affc6d0256b97f056ee728920c579704516408efd39b10a077f40e28091856 cleaned up"
docker # [  269.272092] dockerd[878]: time="2025-09-08T20:43:43.782788424Z" level=info msg="Layer sha256:8f372e6b826972535906d237cc7fc18c035669abe7150ffc7d0e090d2aed1c06 cleaned up"
docker # write /nix/store/qdknxw57cwy1jkrhq7fzmiis73j42jv6-gcc-14.3.0/libexec/gcc/x86_64-unknown-linux-gnu/14.3.0/lto1: no space left on device
docker: output: 
!!! Test "buildNixShellImage: home directory is writable by default" failed with error: "command `/nix/store/2czashy790lp6rk63d6chwdkjr6rdc3k-stream-nix-shell-writable-home | docker load` failed (exit code 1)"
!!! Traceback (most recent call last):
!!!   File "<string>", line 46, in <module>
!!!     docker.succeed(
!!! 
!!! RequestedAssertionFailed: command `/nix/store/2czashy790lp6rk63d6chwdkjr6rdc3k-stream-nix-shell-writable-home | docker load` failed (exit code 1)
cleanup
kill machine (pid 11)
qemu-system-x86_64: terminating on signal 15 from pid 8 (/nix/store/iyff8129iampdw13nlfqalzhxy8y1hi9-python3-3.13.6/bin/python3.13)
kill vlan (pid 9)
(finished: cleanup, in 0.00 seconds)

@l0b0
Copy link
Contributor Author

l0b0 commented Sep 8, 2025

docker # write /nix/store/qdknxw57cwy1jkrhq7fzmiis73j42jv6-gcc-14.3.0/libexec/gcc/x86_64-unknown-linux-gnu/14.3.0/lto1: no space left on device

Not sure why this is - if anything, I would expect the Docker image to contain even less after this change.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

LGTM

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 2 This PR was reviewed and approved by two persons. labels Sep 10, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Oct 15, 2025
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 30, 2025
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 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimise/remove environment.defaultPackages