Commit Graph

64 Commits

Author SHA1 Message Date
Aliaksandr
2dd1349006 stdenv: stop passing crossSystem to local stages
The dispatcher now constructs local bootstrap stages directly, so their target is represented entirely by localSystem. Remove the redundant crossSystem arguments and equality assertions from each local stage implementation.

Assisted-by: codex with gpt-5.6-sol-high
2026-07-19 00:11:51 +03:00
Aliaksandr
125de9a4c3 stdenv: do not pass crossOverlays redundantly
crossOverlays only needed for stageCross, so lets pass them only there
2026-06-06 06:04:25 +03:00
Eman Resu
159a6daf6b stdenv/generic: memoise passing config to mkDerivation unless overriden 2026-05-29 16:51:25 -04:00
zowoq
4ed8c15708 pkgs/stdenv/freebsd: update x86_64-unknown-freebsd bootstrap-files
sha256sum of files to be uploaded:

$ sha256sum /nix/store/9hjgqrmhvny7fxg90w8j7d97f7ny8l8w-build/on-server/*
27ed036ed3e7c58cf0637f8f09d1abe986250b3c373afe44328c48d36aecfbd5  /nix/store/9hjgqrmhvny7fxg90w8j7d97f7ny8l8w-build/on-server/bootstrap-tools.tar.xz
89428a0d543e25f14b0529d17309a426d30a312d5f5db512a5218a3ffc18e52f  /nix/store/9hjgqrmhvny7fxg90w8j7d97f7ny8l8w-build/on-server/unpack.nar.xz

Suggested commands to upload files to 'tarballs.nixos.org':

    $ nix-store --realize /nix/store/9hjgqrmhvny7fxg90w8j7d97f7ny8l8w-build
    $ aws s3 cp --recursive --acl public-read /nix/store/9hjgqrmhvny7fxg90w8j7d97f7ny8l8w-build/on-server/ s3://nixpkgs-tarballs/stdenv/x86_64-unknown-freebsd/87c888eedeced2c577b21a86b5bce79b3067ab20
    $ aws s3 cp --recursive s3://nixpkgs-tarballs/stdenv/x86_64-unknown-freebsd/87c888eedeced2c577b21a86b5bce79b3067ab20 ./
    $ sha256sum bootstrap-tools.tar.xz unpack.nar.xz
    $ sha256sum /nix/store/9hjgqrmhvny7fxg90w8j7d97f7ny8l8w-build/on-server/*
2026-05-26 08:31:10 +10:00
Artemis Tosini
b442a8d76b stdenv/freebsd: upgrade to modern llvm to fix FreeBSD 15 build
Also do some other misc modernization
2026-05-22 12:38:38 -04:00
Silvan Mosberger
56f680d915 fetchurl: Allow hashed mirror overriding with config.hashedMirrors
Allows having alternate hashed mirrors as fallbacks. Useful in case the
default hashed mirror is not accessible or doesn't have everything
needed.

Co-authored-by: Johan Herland <johan.herland@tweag.io>
Co-authored-by: Yuriy Taraday <yuriy.taraday@tweag.io>
Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru>
2025-10-06 14:15:10 +02:00
NAHO
c8d4dabc43 pkgs: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --type file \
      . \
      pkgs \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2025-10-04 19:02:37 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Audrey Dutcher
ec7b23cc8a stdenv/freebsd: provide libiconv for early boot 2025-06-08 19:50:46 -07:00
Audrey Dutcher
61ccd7ea75 stdenv/freebsd: add missing rewriteURL parameter 2025-06-08 19:11:54 -07:00
nixpkgs-ci[bot]
1f3609df68 Merge staging-next into staging 2025-06-06 12:07:42 +00:00
Johan Herland
abda866f17 fetchurl: Add hook for rewriting/filtering URLs
This allows on-the-fly rewriting of URLs before they are passed from
fetchurl (or fetchurlBoot) to curl.

The intended use is to allow inserting company-internal mirrors, or
working around company firewalls and similar network restrictions,
without having to extensively patch across all of nixpkgs. Instead,
users can pass a function in their nixpkgs that performs the necessary
URL rewrites.

Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru>
2025-06-04 10:29:08 +00:00
Audrey Dutcher
3026fd9c90 stdenv/freebsd: copy clang lib folder out of bootstrap archive
Fixes the boot0 build of python
2025-05-31 19:18:12 +00:00
Audrey Dutcher
594993063b stdenv/freebsd: isolate bootstrap process more
Copying instead of symlinking prevents leakage of the bootstrap FHS
into the 0->1 bootstrap stage. The symptom this addresses is libssh2
failing because it can't find libssl, since it is failing to use the
ld wrapper.
2025-05-31 19:15:05 +00:00
Audrey Dutcher
7a0c12bfb5 freebsd.libcMinimal: include i18n path; set relevant environment variable in stdenv 2025-05-28 16:42:47 -07:00
Audrey Dutcher
9821c28acc freebsd stdenv: switch to llvm bintools 2025-05-28 16:42:47 -07:00
Silvan Mosberger
e3491c9e40 bash: Make interactive the default
The status quo of `bash` not being interactive is frustrating for many users,
because trying to use it interactively is just messed up, and
`bashInteractive` is not intuitive and barely discoverable.

This was brought to my (and many others) attention by @stahnma in his
[talk at CfgMgmtCamp 2025](https://cfp.cfgmgmtcamp.org/ghent2025/talk/YUVUTN/),
where he highlighted this as one of the frustrations he ran into when
learning Nix.

Why this is fine:
- No reason for not making interactive the default was given in the original commit (6c6ff6f36f), but probably it was due to the increase in closure size
- The closure size only increases by 6.9MiB (19.5%) today, with the
  added dependency on the store paths for readline and ncurses, which
  are needed on systems in almost all cases anyways
- If somebody really needs to get a more minimal system, they can use
  the newly-introduced `bashNonInteractive` instead now
- Though to apply it consistently, they'll need to do that in an
  overlay like
  ```
  final: prev: {
    bash = self.bashNonInteractive;
  }
  ```

  Or alternatively using the `system.replaceDependencies.replacements`
  NixOS option approach.

While there's also other such `*Interactive` packages that could use the
same treatment, `bash` is a great start.

This was already attempted before in
https://github.com/NixOS/nixpkgs/pull/151227, but was not continued for
unknown reason.

To avoid stdenv becoming bigger, all uses of bash in the (working)
stdenv's are changed to the explicitly non-interactive version here.

This commit will however still cause a mass rebuild for all packages (and reverse deps)
making use of the default bash.
2025-02-05 00:31:46 +01:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Audrey Dutcher
2ca435a540 freebsd stdenv: be more principled about portioning out bootstrap libraries 2024-11-17 09:36:15 -07:00
Jörg Thalheim
0a4aaa9d9a pkgs/stdenv/freebsd: update x86_64-unknown-freebsd bootstrap-files
sha256sum of files to be uploaded:

$ sha256sum /nix/store/yy36y5s9i4wl768imwfn112sb7w3pyk8-build/on-server/*
a072dd769596c1efe2c58b9fde141f986ac6ba2c45dfe1bc1c29be07b8370b36  /nix/store/yy36y5s9i4wl768imwfn112sb7w3pyk8-build/on-server/bootstrap-tools.tar.xz
71ff3ba54f0741355948f403db95f2c54ae3b69dd39f991fdad17ae5ab623a77  /nix/store/yy36y5s9i4wl768imwfn112sb7w3pyk8-build/on-server/unpack.nar.xz

Suggested commands to upload files to 'tarballs.nixos.org':

    $ nix-store --realize /nix/store/yy36y5s9i4wl768imwfn112sb7w3pyk8-build
    $ aws s3 cp --recursive --acl public-read /nix/store/yy36y5s9i4wl768imwfn112sb7w3pyk8-build/on-server/ s3://nixpkgs-tarballs/stdenv/x86_64-unknown-freebsd/b92edf1104c47016385e85c87c2d953cf5cd2f98
    $ aws s3 cp --recursive s3://nixpkgs-tarballs/stdenv/x86_64-unknown-freebsd/b92edf1104c47016385e85c87c2d953cf5cd2f98 ./
    $ sha256sum bootstrap-tools.tar.xz unpack.nar.xz
    $ sha256sum /nix/store/yy36y5s9i4wl768imwfn112sb7w3pyk8-build/on-server/*
2024-11-04 20:24:05 +01:00
Audrey Dutcher
5da4fa1dd6 stdenv/freebsd: don't inherit curl from previous stage
This was adding dependencies on the bootstrap files for longer than
necessary.
2024-09-09 19:40:56 -07:00
Audrey Dutcher
423dc16f1a Include libclang-rt in the FreeBSD bootstrap tools 2024-09-08 11:08:07 -07:00
Jörg Thalheim
54216ceb22 pkgs/stdenv/freebsd: update x86_64-unknown-freebsd bootstrap-files
sha256sum of files to be uploaded:

$ sha256sum /nix/store/ikzxl9ws9yxrl8g8z2kcjwqlq5gfjbhx-build/on-server/*
7fb16ac6da63effd126ecfa452032cee82742663ee8776ea0f66333814f0d9f7  /nix/store/ikzxl9ws9yxrl8g8z2kcjwqlq5gfjbhx-build/on-server/bootstrap-tools.tar.xz
aff88c12a32eab790f8bbaea08ef4917b0a52ea71ca2fcefe8093f1f40c1ff27  /nix/store/ikzxl9ws9yxrl8g8z2kcjwqlq5gfjbhx-build/on-server/unpack.nar.xz

Suggested commands to upload files to 'tarballs.nixos.org':

    $ nix-store --realize /nix/store/ikzxl9ws9yxrl8g8z2kcjwqlq5gfjbhx-build
    $ aws s3 cp --recursive --acl public-read /nix/store/ikzxl9ws9yxrl8g8z2kcjwqlq5gfjbhx-build/on-server/ s3://nixpkgs-tarballs/stdenv/x86_64-unknown-freebsd/6414ef7ca3bf18ec4f9628d09ccc1eb030276ee2
    $ aws s3 cp --recursive s3://nixpkgs-tarballs/stdenv/x86_64-unknown-freebsd/6414ef7ca3bf18ec4f9628d09ccc1eb030276ee2 ./
    $ sha256sum bootstrap-tools.tar.xz unpack.nar.xz
    $ sha256sum /nix/store/ikzxl9ws9yxrl8g8z2kcjwqlq5gfjbhx-build/on-server/*
2024-09-07 09:19:18 +02:00
Audrey Dutcher
f3a104c11a stdenv/freebsd: do not require recursive-nix 2024-08-22 00:09:55 -07:00
Audrey Dutcher
90bf0c5119 stdenv/freebsd: rsync with --safe-links
This discarss links with absolute paths, which are useless for the
bootstrap tools.
2024-08-22 00:06:44 -07:00
Audrey Dutcher
43fb06aa92 freebsd: 14.0 -> 14.1 2024-07-28 19:42:11 +00:00
Audrey Dutcher
c3c71a9809 [squashme] finish rename 2024-07-20 16:40:02 -07:00
Audrey Dutcher
8d34730121 [squashme] elaborate comment on unpack-bootstrap-files.sh 2024-07-20 09:23:29 -07:00
Audrey Dutcher
3cf427ebe3 [squashme] rename linkBS to linkBootstrap 2024-07-20 09:21:23 -07:00
Audrey Dutcher
c494d17409 [squashme] remove unused/bad code 2024-07-20 09:20:33 -07:00
Audrey Dutcher
37affb5b76 [squashme] Remove some hacks 2024-07-19 21:32:08 -07:00
Audrey Dutcher
9dbd5a9a9d [squashme] do the requested changes 2024-07-19 21:32:07 -07:00
Audrey Dutcher
1e2071847d stdenv/freebsd: reinit
The old stdenv didn't work, and was also impure. The new one works, and
is pure. Presently, the bootstrap tools are cross compiled into one small
nar and one large tar, which is then unpacked, patched, and split into
smaller derivations. Efforts were made to make the boot process as short
as possible - there are only two clangs built, and as many packages are
propagated between stages as possible while leaving the bootstrap tools
out of the final stdenv's closure.
2024-07-19 21:32:05 -07:00
Artturin
33415135b0 config.contentAddressedByDefault: init option 2022-04-27 23:21:32 +03:00
regnat
14f66d60a7 Make the bootsrap respect the contentAddressedByDefault setting
Patch every `derivation` call in the bootsrap process to add it a
conditional `__contentAddressed` parameter.

That way, passing `contentAddressedByDefault` means that the entire
build closure of a system can be content addressed
2021-04-28 10:25:49 +02:00
sternenseemann
62ec3db017 stdenv/freebsd/cc: make overrideable fixing nixpkgs eval
stdenv.cc didn't have an override attribute on FreeBSD previously,
breaking evaluation of all-packages.nix consequently.

Resolves #119075.
2021-04-15 12:49:41 +02:00
Ashish SHUKLA
1c39662e63 stdenv: Improve/fix FreeBSD support
Able to bootstrap stdenv on FreeBSD by compiling various dependencies
using built-in FreeBSD tools so mostly works now

Closes: https://github.com/NixOS/nixpkgs/pull/81459
2021-02-07 15:24:16 +00:00
volth
bc0d605cf1 treewide: fix double quoted strings in meta.description
Signed-off-by: Ben Siraphob <bensiraphob@gmail.com>
2021-01-24 19:56:59 +07:00
Matthew Bauer
a3a6ad7a01 stdenv: implement crossOverlays
crossOverlays only apply to the packages being built, not the build
packages. It is useful when you don’t care what is used to build your
packages, just what is being built. The idea relies heavily on the
cross compiling infrastructure. Using this implies that we need to
create a cross stdenv.
2018-12-04 21:06:46 -06:00
Jan Malakhovski
a89899ce4e fetchurl: cleanup, better errors
Also fix what seems like bugs in uncommon `stdenv`s.
2018-02-18 14:24:53 +00:00
John Ericson
d349f9a340 cc-wrapper: Use stdenvNoCC to build
cc-wrapper may wrap a cc-compiler, but it doesn't need one to build
itself. (c.f. expand-response-params is a separate derivation.) This
helps avoid cycles on the cross stuff, in addition to removing a
useless dependency edge.

I could have been super careful with overrides in the stdenv to avoid
the mass rebuild, but I don't think it's worth it.
2017-09-26 14:08:21 -04:00
John Ericson
c035711072 cc-wrapper: Remove unused params
Ensured hashes unchanged and eval succeeds in tarball job
2017-08-21 18:40:41 -04:00
John Ericson
a302d7360f top-level: {build,host,target}Platform are defined in the stdenv instead
See #27069 for a discussion of this
2017-07-07 12:55:02 -04:00
John Ericson
459f1c60f5 cc-wrapper: Learn about target prefixes
This is first step towards getting rid of gcc-wrapper-cross
2017-06-22 17:52:27 -04:00
John Ericson
c4ba2e3ef6 cc-wrapper: Remove stdenv.is* for targetPlatform.is*
Modify bootstrapping stdenvs to make sure `targetPlatform` also passed.
2017-06-22 17:52:27 -04:00
John Ericson
1dc6f15de9 stdenv: define is* predicates with hostPlatform.is*
This is a saner default until stdenv's are removed altogether
2017-05-22 00:25:02 -04:00
John Ericson
92edcb7ebb top-level: Lay the groundwork for {build,host,target}Platform
The long term goal is a big replace:
  { inherit system platform; } => buildPlatform
  crossSystem => hostPlatform
  stdenv.cross => targetPlatform
And additionally making sure each is defined even when not cross compiling.

This commit refactors the bootstrapping code along that vision, but leaves
the old identifiers with their null semantics in place so packages can be
modernized incrementally.
2017-01-24 11:37:56 -05:00
Nicolas B. Pierron
f5dfe78a1e Add overlays mechanism to Nixpkgs.
This patch add a new argument to Nixpkgs default expression named "overlays".

By default, the value of the argument is either taken from the environment variable `NIXPKGS_OVERLAYS`,
or from the directory `~/.nixpkgs/overlays/`.  If the environment variable does not name a valid directory
then this mechanism would fallback on the home directory.  If the home directory does not exists it will
fallback on an empty list of overlays.

The overlays directory should contain the list of extra Nixpkgs stages which would be used to extend the
content of Nixpkgs, with additional set of packages.  The overlays, i-e directory, files, symbolic links
are used in alphabetical order.

The simplest overlay which extends Nixpkgs with nothing looks like:

```nix
self: super: {
}
```

More refined overlays can use `super` as the basis for building new packages, and `self` as a way to query
the final result of the fix-point.

An example of overlay which extends Nixpkgs with a small set of packages can be found at:
  https://github.com/nbp/nixpkgs-mozilla/blob/nixpkgs-overlay/moz-overlay.nix

To use this file, checkout the repository and add a symbolic link to
the `moz-overlay.nix` file in `~/.nixpkgs/overlays` directory.
2017-01-16 01:17:33 +01:00
John Ericson
3e197f7d81 top-level: Normalize stdenv booting
Introduce new abstraction, `stdenv/booter.nix` for composing bootstraping
stages, and use it everywhere for consistency. See that file for more doc.

Stdenvs besides Linux and Darwin are completely refactored to utilize this.
Those two, due to their size and complexity, are minimally edited for
easier reviewing.

No hashes should be changed.
2017-01-13 13:23:23 -05:00
John Ericson
4751d9e5ad top-level: turn the screw
- Non-cross stdenvs are honest and assert that `crossSystem` is null

 - `crossSystem` is a mandatory argument to top-level/stage.nix, just like
   `system` and `platform`

 - Broken default arguments on stdenvs for testing are gone.

 - All stdenvs (but little-used stdenvNix) take the same arguments for easy
   testing.
2016-12-01 11:24:33 -05:00