wh0
June 3, 2024, 5:21am
1
I found that I can’t use the new x86_64 Linux glibc bootstrap tools on my systems, so I built my own based on the nixpkgs commit and some custom patches to glibc. I’m using overlays to add patches to glibc and some other packages. Is there a way to modify the bootstrap files URLs+hashes with an overlay or similar?
I’d need to have nixpkgs use different files here:
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=x86_64-unknown-linux-gnu
#
# Metadata:
# - nixpkgs revision: 82b583ba2ba2e5706b35dbe23f31362e62be2a9d
# - hydra build: https://hydra.nixos.org/job/nixpkgs/trunk/stdenvBootstrapTools.x86_64-unknown-linux-gnu.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/249165517
# - instantiated derivation: /nix/store/7g8mrv13mi4zrx66fw0hy4c46j752wfd-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/dw6vr6m5w7ysrdrbs0s5wdgbjmbnr7gx-stdenv-bootstrap-tools
# - build time: Sat, 10 Feb 2024 01:29:55 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-gnu/82b583ba2ba2e5706b35dbe23f31362e62be2a9d/bootstrap-tools.tar.xz";
hash = "sha256-YQlr088HPoVWBU2jpPhpIMyOyoEDZYDw1y60SGGbUM0=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-gnu/82b583ba2ba2e5706b35dbe23f31362e62be2a9d/busybox";
hash = "sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=";
executable = true;
};
This file has been truncated. show original
Background info: I’m running Nix in an old container runtime that doesn’t know about the faccessat2 syscall, and it gives EPERM instead of ENOSYS. The glibc used in the new bootstrap tools uses faccessat2, so the coreutils reports everything as not executable, not writable, not readable, etc. Building a normal package e.g. in the early bootstrap process will fail with
no configure script, doing nothing
as it comes to believe there is no executable ./configure
in packages that are meant to have them.
trofi
June 3, 2024, 5:58am
2
AFAIU there is no good way to do it today and it would be useful to have that mechanism. Allow user to supply their `bootstrapFiles` set of tools · Issue #272750 · NixOS/nixpkgs · GitHub to track it’s addition.
1 Like
wh0
June 4, 2024, 6:37am
3
thanks, I read a lot of your blog on how the bootstrapping works.
I figure we might as well try adding this functionality given that there’s more than one person interested
NixOS:master
← wh0:patch-1
opened 06:32AM - 04 Jun 24 UTC
## Description of changes
This adds a config option `replaceBootstrapFiles`. … It's a function that takes the normal bootstrap files and returns your custom bootstrap files.
Example nixpkgs/config.nix:
```nix
{
replaceBootstrapFiles = prevFiles:
let replacements = {
"sha256-YQlr088HPoVWBU2jpPhpIMyOyoEDZYDw1y60SGGbUM0=" = import <nix/fetchurl.nix> {
url = "(custom glibc linux x86_64 bootstrap-tools.tar.xz)";
hash = "(...)";
};
"sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=" = import <nix/fetchurl.nix> {
url = "(custom glibc linux x86_64 busybox)";
hash = "(...)";
};
};
in builtins.mapAttrs (name: prev: replacements.${prev.outputHash} or prev) prevFiles;
}
```
<!--
For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
For new packages please briefly describe the package or provide a link to its homepage.
-->
## Things done
- Built on platform(s)
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- For non-Linux: Is sandboxing enabled in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] `sandbox = relaxed`
- [ ] `sandbox = true`
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] 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](https://github.com/Mic92/nixpkgs-review#usage)
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [24.11 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2411.section.md) (or backporting [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) and [24.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) Release notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added 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](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
<!--
To help with the large amounts of pull requests, we would appreciate your
reviews of other pull requests, especially simple package updates. Just leave a
comment describing what you have tested in the relevant package/service.
Reviewing helps to reduce the average time-to-merge for everyone.
Thanks a lot if you do!
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
Reviewing guidelines: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#reviewing-contributions
-->
---
Add a :+1: [reaction] to [pull requests you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
1 Like