Commit Graph

347 Commits

Author SHA1 Message Date
Audrey Dutcher
6b0a1f8123 freebsd.libc: break into many small derivations 2024-11-27 00:38:57 -07:00
John Ericson
07f8638828
freebsd: Add support for aarch64 (#358053) 2024-11-26 20:39:38 -05:00
John Ericson
ad1320e259
freebsd: set BOOTSTRAPPING when building for Linux (#337351) 2024-11-26 17:58:42 -05:00
Artemis Tosini
2b02a18ef7
freebsd: Add support for aarch64
Add a new `aarch64-freebsd` double and example system,
then fix include and libc to work.
This is enough to build packages like `hello`,
either static or dynamic.

This is useful for testing nix FreeBSD on a Raspberry Pi.
2024-11-24 03:03:28 +00:00
Audrey Dutcher
c565ccd326 freebsd: improve overridability of entire package set
- remove duplicated patches directory attribute
- make several version number checks >= or <= instead of ==
- add kernel derivation parameters to adjust build config
2024-11-19 16:23:51 -07:00
Audrey Dutcher
df1ec7d093 freebsd.mkDerivation: move all environment variable declarations into env attrset 2024-11-17 19:32:48 -07:00
Artemis Tosini
337b2fd99d freebsd.localedef: Fix formatting 2024-11-17 19:30:27 -07:00
Audrey Dutcher
623ecef987 freebsd: set BOOTSTRAPPING when building for Linux
FreeBSD loves to access system headers for platform-specific builtins.
This is fine on FreeBSD but often breaks when building utilities for
Linux. `BOOTSTRAPPING` disables using most of these headers.

Instead of adding workarounds to every package, just set `BOOTSTRAPPING`
when the host platform is not FreeBSD.
2024-11-17 19:30:26 -07:00
John Ericson
63de88ed5f
openbsd.sys (OpenBSD kernel): init (#353935) 2024-11-14 22:06:48 -05:00
Artemis Tosini
3406583205
openbsd.sys: init
`sys` includes the OpenBSD kernel.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-12 21:03:39 +00:00
Artemis Tosini
97c0dbaf3e
openbsd.make-rules: Fix hardcoded /bin/pwd
OpenBSD loves hardcoding paths to programs.
The only example of this in `bsd.obj.mk` is `/bin/pwd`,
so `substituteInPlace` is fine.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-12 20:27:58 +00:00
Artemis Tosini
19a0c22484
openbsd.boot-ctags: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-12 20:27:58 +00:00
Artemis Tosini
5cd3d0ef0f
openbsd.boot-config: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-12 20:27:58 +00:00
Artemis Tosini
d48f526db3
openbsd.{compat,compatHook}: init
OpenBSD does not provide a compatibility library for running
build tools on other OSes, but we still need one.
`openbsd.compat` inspired by the `freebsd.compat` package and provides
a header-only compatibility layer that can be used across multiple
openbsd build packages. The source is included in the nixpkgs tree
because it functions similarly to per-package patches.

`openbsd.compatHook` provides a build hook that can be added into
`extraNativeBuildInputs` to include `compat` in the library search
path as a system library.
2024-11-12 20:27:58 +00:00
Artemis Tosini
51a07b20cd
openbsd.mkDerivation: add extraNativeBuildInputs input
Some packages require extra hooks or tools.
Rather than overriding all of the nativeBuildInputs
and needing to specify all of them, add a field so that
we just need to specify inputs that are not always required.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-12 20:26:21 +00:00
Emily
ce788776a5 Merge master into staging-next 2024-11-09 12:51:01 +00:00
aleksana
571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00
Martin Weinelt
2900723943
Merge remote-tracking branch 'origin/master' into staging-next 2024-11-08 18:40:48 +01:00
John Ericson
50f7983ec7
openbsd.stand: init (#353925) 2024-11-08 09:14:30 -05:00
John Ericson
f86e4be082
openbsd.makefs: init (#353929) 2024-11-08 09:10:40 -05:00
Emily
8072991b1d
apple-sdk: propagate the libutil library (#353873) 2024-11-07 01:05:45 +00:00
Emily
7863b8cf18 netbsd.install: drop darwin.libutil dependency 2024-11-07 00:39:35 +00:00
Artemis Tosini
f8cc3fce40
openbsd.makefs: init
OpenBSD's makefs is used to create filesystem images for ramdisks
or VM/install images. The build was fixed with a patch instead of
adding to `compat` because `makefs` relies heavily on unintended
and undocumted transitive header inclusions. Fixing with `compat`
causes hard-to-debug header loops.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-05 22:48:23 +00:00
Artemis Tosini
80d9fe945b
openbsd.stand: init
This stand package builds all variants of OpenBSD's
`stand` bootloader, including both UEFI and BIOS versions.

This package will likely need changes if we ever support
`aarch64-openbsd`, but that isn't even a target yet.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-05 22:35:14 +00:00
Audrey Dutcher
83f0e7c881
freebsd.mkimg: support openbsd partitions guids
OpenBSD does not have a tool comparable to FreeBSD's
`mkimg`, but we still need one to create OpenBSD install
and VM images.

FreeBSD's mkimg already does what we need except setting
the correct partition ID, so add a new `openbsd-ufs` type.
2024-11-05 22:25:45 +00:00
Audrey Dutcher
2cb5d44622
freebsd.init: mark as broken when built dynamically (it is a static binary) 2024-11-04 03:13:32 +00:00
Audrey Dutcher
baed931613
freebsd: Support static binaries
Co-Authored-By: Artemis Tosini <me@artem.ist>
2024-11-04 03:13:32 +00:00
github-actions[bot]
ef782655d2
Merge master into staging-next 2024-10-24 18:04:38 +00:00
Artemis Tosini
fcd62ad082
openbsd.rtld: init
rtld contains ld.so, the dynamic linker on OpenBSD.
This package does not include related scripts (ldd and ldconfig),
because they would create a dependency loop.
rtld (run-time ld) is an os-agnostic term for dynamic linker.

For simplicity, also link this into the libc symlinkJoin package
2024-10-24 00:43:24 +00:00
Artemis Tosini
f5194c3579
openbsd.openbsdSetupHook: Fix bsd.prog.mk
bsd.prog.mk makes sure libc is built before programs that use it by
making all programs depend on core files.

We handle this dependency by referencing libc in cc-wrapper,
but that isn't sufficient to tell bsd.prog.mk that e.g. crtbegin.o
exists.

Clear libc-related variables to fix OpenBSD program build
2024-10-24 00:11:49 +00:00
Randy Eckenrode
5d128a9edc
netbsd.install: fix build with new Darwin SDK
To avoid adding headers to the SDK it does not have normally
(`libutil.h`), darwin.libutil is not propagated. It must be included as
a build input when it is needed by packages.
2024-10-10 01:07:20 -04:00
K900
b29cb6c1f9 Merge remote-tracking branch 'origin/master' into staging-next 2024-09-30 20:23:25 +03:00
Philip Taron
d590835329
fetchers: uniformly support the hash attribute (#342173) 2024-09-30 07:55:36 -07:00
Artturin
f0e657f3b1 Merge branch 'master' into staging-next 2024-09-25 06:05:01 +03:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
github-actions[bot]
bcd5388d39
Merge master into staging-next 2024-09-24 12:05:12 +00:00
Audrey Dutcher
b2f439596d freebsd.mkDerivation: use stdenvNoLibs instead of stdenvNoLibc to avoid compiler-rt 2024-09-23 16:59:49 -07:00
github-actions[bot]
1f0ce6a4e5
Merge staging-next into staging 2024-09-19 12:05:50 +00:00
Jörg Thalheim
4f91815a07
freebsd: Fix obscure c++98 interaction used by gbenchmark (#335454) 2024-09-19 14:00:59 +02:00
nicoo
8af38be358 netbsd: sha256hash 2024-09-17 15:00:28 +00:00
Wolfgang Walther
202bfa48fd
freebsd: support structuredAttrs in setup hook
Couldn't test this, because freebsd.compat is failing with unrelated
errors for me.
2024-09-08 22:11:10 +02:00
Wolfgang Walther
9e836fddfe
openbsd: support structuredAttrs in setup hook
Tested openbsd.lorder with and without __structuredAttrs.
2024-09-08 22:11:10 +02:00
Wolfgang Walther
c3470fdfb7
netbsd: support structuredAttrs in setup hook
Tested netbsd.lorder with and without __structuredAttrs.
2024-09-08 22:11:10 +02:00
Wolfgang Walther
88a44bc843
bsd: shellcheck setup hook 2024-09-08 22:11:10 +02:00
Wolfgang Walther
c0e250354a
bsd: support structuredAttrs in setup hook
Tested netbsd.compat with and without structuredAttrs.
2024-09-08 22:11:10 +02:00
Wolfgang Walther
01126ae1e7
netbsd: use env. to pass RENAME environment variable
This is required to test netbsd.compat with structuredAttrs turned on
once the setup hooks support it.
2024-09-08 22:11:10 +02:00
John Ericson
f43cc75868
Clean up cross bootstrapping, take 2 (#321525) 2024-09-06 14:56:54 -04:00
John Ericson
5f134ec6cf Clean up cross bootstrapping
For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes,
and `*bsdCross` pre-libc package sets. This was always bad because
having "cross" things is "not declarative": the naming doesn't reflect
what packages *need* but rather how we *provide* something. This is
ugly, and creates needless friction between cross and native building.

Now, almost all of these `*Cross` attributes are gone: just these are
kept:

- Glibc's and Musl's are kept, because those packages are widely used
  and I didn't want to risk changing the native builds of those at this
  time.

- generic `libcCross`, `theadsCross`, and friends, because these relate
  to the convolulted GCC bootstrap which still needs to be redone.

The BSD and obscure Linux or freestnanding libcs have conversely all
been made to use a new `stdenvNoLibc`, which is like the old
`crossLibcStdenv` except:

1. It usable for native and cross alike

2. It named according to what it *is* ("a standard environment without
   libc but with a C compiler"), rather than some non-compositional
   jargon ("the stdenv used for building libc when cross compiling",
   yuck).

I should have done this change long ago, but I was stymied because of
"infinite recursions". The problem was that in too many cases we are
overriding `stdenv` to *remove* things we don't need, and this risks
cyles since those more minimal stdenvs are used to build things in the
more maximal stdenvs.

The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to
*build up* rather than *tear down*. For now, the full `stdenv` is also
passed, so I don't need to change the native bootstraps, but I can see
this changing as we make things more uniform and clean those up.

(adapted from commit 51f1ecaa59)
(adapted from commit 1743662e55)
2024-09-06 10:26:56 -04:00
Philip Taron
7b3a3f3f8b
freebsd.mkDerivation: remove with statements 2024-08-18 06:31:18 -07:00
Audrey Dutcher
9e9a1f737d freebsd: Add upstream patch fixing obscure c++98 interaction
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276738#c12

Using _Static_assert under -std=c++98 -pedantic-errors will fail in
FreeBSD 14.1. This fixes that, allowing software like gbenchmark to
run its tests against legacy c++ standards. This patch is pending for
FreeBSD 14.2, and should be removed for that release.
2024-08-16 14:26:48 -07:00