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

RFC: Minimise accidental users of minimal-bootstrap package set #244966

Closed
emilytrau opened this issue Jul 23, 2023 · 8 comments · Fixed by #262901
Closed

RFC: Minimise accidental users of minimal-bootstrap package set #244966

emilytrau opened this issue Jul 23, 2023 · 8 comments · Fixed by #262901
Labels
0.kind: enhancement 6.topic: bootstrap Bootstrapping, avoiding pre-built binaries. Often overlaps with cross-compilation.

Comments

@emilytrau
Copy link
Member

Background

The minimal-bootstrap package set's goal to provide an opaque replacement for bootstrap-tools in the stdenv. The chain to get from the seed binary to that point includes many packages that may be outdated, insecure, or contain broken/missing features. In addition the research into bootstrappable builds is always evolving, and we may want to add or remove packages into the internal dependency chain without guarantee of stability. These packages are not intended to be used directly by end-users.

Issues

Tools (such as search.nixos.org, repology, etc.) currently index this package set and provide discoverability to users. Trying to use these packages in the real world will currently most likely fail, warning you that the only supported platform is i686-linux. However a more robust conditional check with better errors and documentation could be implemented to limit accidental use.

Another potential minor annoyance might be vulnerability scanning tools detecting the use of old package versions deep down in the stdenv bootstrap and triggering a false-positive. Example (repology)

There are some tools that evaluate this package set that we do want to keep working. An important example would be Ofborg's eval checks and maintainer pings.

Ideas

I came up with two potential improvements but neither would completely solve all the issues. I'm very interested to get everyone's ideas and comments to work together for a solution.

Maintainers

@amjoseph-nixpkgs @Artturin @Ericson2314 @06kellyjac @siraben

@emilytrau emilytrau added 0.kind: enhancement 6.topic: bootstrap Bootstrapping, avoiding pre-built binaries. Often overlaps with cross-compilation. labels Jul 23, 2023
@emilytrau
Copy link
Member Author

Related #227914

@emilytrau emilytrau changed the title Proposal: Minimise accidental users of minimal-bootstrap package set RFC: Minimise accidental users of minimal-bootstrap package set Jul 23, 2023
@Ericson2314
Copy link
Member

I think I would just create a new meta field, and then ask other tools to respect it.

See also https://discourse.nixos.org/t/nixpkgs-cli-working-group-member-search/30517 which would give Nixpkgs more direct control over the JSON Repology gets, rather than hoping nix-env does what we want.

@ghost
Copy link

ghost commented Jul 24, 2023

(I liked the original title better; Nix has a culture-specific redefinition of what "RFC" means, and an entire baroque process for doing them).

Another potential minor annoyance might be vulnerability scanning tools detecting the use of old package versions deep down in the stdenv bootstrap and triggering a false-positive. Example (repology)

Honestly this sounds like a problem with Repology, not Nixpkgs.

Trying to use these packages in the real world will currently most likely fail, warning you that the only supported platform is i686-linux

Easy solution: don't expose it as a top-level entry in all-packages.nix. Make it private to pkgs/stdenv (which is where we should consider moving it once we are ready to make the switch).

@Ericson2314
Copy link
Member

I would not like to just put in pkgs/stdenv because I have long wanted to separate "bootstrapping" and "the standard environment" as two independent concepts.

@ghost
Copy link

ghost commented Jul 25, 2023

I would not like to just put in pkgs/stdenv because I have long wanted to separate "bootstrapping" and "the standard environment" as two independent concepts.

Ah, I see. Okay, sounds good.

My point was that stdenv needs to reference the minimal-bootstrap result somehow, and that we can keep that reference "private" by not having it detour through all-packages.nix (or its successor, pkgs/by-name, now that the RFC is merged).

@Atemu
Copy link
Member

Atemu commented Oct 22, 2023

Search and Repology use the packages.json we export as part of the channel tarballs. What's listed in the JSON is what they will show.

I think the solution to this issue is simply to not recurse into the minimal-bootstrap set; removing its attrs from the JSON.

There's two ways of doing that:

  1. Remove the recurseIntoAttrs in all-packages.nix
  2. Override it with dontRecurseIntoAttrs in pkgs/top-level/packages-config.nix

1. would stop recursion for all tools making use of nix-env to generate the whole list of packages in Nixpkgs including tools such as ofBorg, nixpkgs-review and nix-env -qa while 2. would only affect tools consuming our generated packages JSON.

@Ericson2314
Copy link
Member

Yeah dontRecurseIntoAttrs is fine.

@emilytrau
Copy link
Member Author

@Atemu would you be able to make a PR for 2 please? It sounds good, I'm just not 100% confident I understand enough to implement it right myself

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement 6.topic: bootstrap Bootstrapping, avoiding pre-built binaries. Often overlaps with cross-compilation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants