Commit Graph

4469 Commits

Author SHA1 Message Date
Wolfgang Walther
aefcb0d50d treewide: run nixfmt 1.0.0 2025-07-24 14:58:18 +02:00
Gutyina Gergő
977242de6d lib: prefer replaceString over replaceStrings
(cherry picked from commit b3b0fd266b)
2025-07-09 16:41:16 +00:00
Gutyina Gergő
feb1a72ead lib/strings: init replaceString
(cherry picked from commit b5720e2b3f)
2025-07-09 16:41:16 +00:00
Alyssa Ross
b5ba0055ef nixVersions.nix_2_3: add knownVulnerabilities
(cherry picked from commit a61841a597)
2025-06-30 10:39:18 +02:00
sodiboo
7c871446f4 lib.types.attrTag: expose suboptions at correct level
(cherry picked from commit b3c9916455)
2025-06-23 06:44:11 +00:00
Jade Lovelace
baf024b092 ci/eval: accept nix directly
Previously we were taking nixVersions and this made external use from
the Lix repo's CI annoying.

We should probably also test other nix versions than stable (i.e. also
latest and Lix), but this involves writing GitHub Actions about it and
maybe not running it on every single PR. Future work.

(cherry picked from commit 332bc64369)
2025-06-10 23:33:09 +00:00
Wolfgang Walther
af25d1ce8c lib/tests: avoid full rebuild when only maintainers change
The vast majority of CI jobs to build the lib tests are caused by
changes in the maintainer list. In this case, we currently run the full
test-suite which takes 3-4 minutes. By moving the maintainers and teams
tests out of the test-with-nix file, we save almost all of that.
Building only those two tests on a change is almost instant. This only
works, because we previously enabled cachix for the workflow.

Note, that these tests are not actually run with both nix versions, even
though they were listed in the "test with specific nix version" file.
That's because we only differ in the nix version run *inside* the
sandbox, but not doing the outer build.

Since this file seems to be re-used by NixOS/nix' CI, this is
technically a small loss in coverage for that repo, but nixpkgs CI
considerations outweigh that. But because of this, I left the other
non-nix-version-specific tests in that file.

(cherry picked from commit a7f4e0f9ae)
2025-06-02 07:31:00 +00:00
Emily
ea235dc9ee Revert "lib.meta.availableOn: Return false if pkg parameter is null"
I believe this change is wrong both theoretically and practically.

Theoretically, `null` is available on every platform, because
`buildInputs = [ null ];` always succeeds and never throws a platform
availability error. `null` should be handled consistently with packages
that have no explicit list of supported platforms, as it of course
has no such list itself.

Practically, we use `null` to represent libraries that are always
present on a platform and do not require a library (for instance,
because they are part of `libc` or the macOS SDK). This has been
used for a long time by `libintl` (on all non‐glibc platforms),
and is also now used by `libGL` and friends on Darwin. This change
broke the check SDL3 does for OpenGL availability on Darwin, causing
<https://github.com/NixOS/nixpkgs/issues/407056>, which had to be
worked around by <https://github.com/NixOS/nixpkgs/pull/409525>.

Both `libintl` and `libGL` should count as available on platforms
where their functionality is part of the standard build environment,
and a package that is completely unavailable and whose functionality
cannot be expected should not use `null`, as it should result in
errors if used in a dependency list on an unsupported platform.

I accept that overriding with `null` is often a useful way to disable
dependencies that don’t have explicit feature flags, but I do not
think that making it work better with feature flags conditioned on
availability is worth the inconsistency and problems caused by this
change. Packages can instead expose the relevant feature flags as
arguments that default to the `lib.meta.availableOn` check or, if they
want to keep an “override the dependency to `null`” interface,
insert an explicit `pkg != null && …` check.

Additionally, the pull request was merged over a week after all
breaking changes were restricted for the 25.05 release. I believe that
the potential problems of dealing with the effects of this change for
an entire release cycle – the first release cycle where `libGL` is
`null` on Darwin, a change I made before the deadline and before this
change to `lib.meta.availableOn` – offset the risks of backporting
this revert at such a late stage.

It will cause overrides to backwards‐incompatibly revert to the
behaviour they had before the change, but since such overrides were
not possible until a few weeks ago, I hope that is an acceptable risk
compared to the potential issues leaving this in the release can
cause, given that it was merged after the deadline and has already
broken an existing construction in Nixpkgs.

This reverts commit 9338d924db.

(cherry picked from commit 98dbc7cc58)
2025-05-23 17:39:28 +00:00
Arian van Putten
871526be1f nixos/image/repart: Use own assertions / warnings. (#406940) 2025-05-15 19:14:53 +02:00
Aleksana
40a774220d ipxe: correct licensing information (#390934) 2025-05-15 21:42:59 +08:00
Alyssa Ross
7eb2580981 lib.systems.examples.riscv64-musl: init 2025-05-15 14:44:58 +02:00
Morgan Jones
865c1cb0e9 lib/systems: remove android cruft (#406682) 2025-05-14 17:46:48 -07:00
Will Fancher
4b0d1225f5 lib/asserts: Factor out NixOS's toplevel assertion / warning logic. 2025-05-14 01:21:10 -04:00
Fernando Rodrigues
8d21ee745e licenses: add gpl2UBDLPlus
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2025-05-13 16:49:21 +00:00
Morgan Jones
9d3c069cbd lib/systems: remove android cruft
These used legacy names for Android SDK and NDK versions, so now we can
do away with them.
2025-05-12 23:43:16 -07:00
Jeremy Fleischman
63c815dd79 docs: fix typo: readDir -> dirOf
The example code here uses `dirOf`, not `readDir`. I assume this was
just a silly typo.
2025-05-12 00:36:30 -07:00
Matt Sturgeon
1fb1446380 lib.modules.importApply: Fix doc typo; _keykey
The `importApply` docs reference using the `_key` attr along with
`importApply` or `_file`, however the actual attr name used by the
module system is `key`.
2025-05-08 17:48:50 +01:00
Johannes Kirschbauer
5ee93d2532 lib: refactor lib.attrsets.{mapAttrs', mapAttrsToList} and mapAttrs'' in the strongswan-swanctl module (#403581) 2025-05-08 09:42:40 +02:00
ccicnce113424
4551258940 lib: refactor lib.attrsets.{mapAttrs', mapAttrsToList} and mapAttrs'' in the strongswan-swanctl module
The new implementation of `mapAttrsToList` is simpler than the previous one, avoiding an extra string conversion. Benchmarking shows a slight performance improvement. See the discussion here: https://discourse.nixos.org/t/another-implementation-of-mapattrstolist

Additionally, I searched nixpkgs for expressions equivalent to the old `mapAttrsToList` and replaced them with direct calls to the new implementation.
2025-05-08 13:58:54 +08:00
Wolfgang Walther
c8d2eca963 .editorconfig: move subfolder config into separate .editorconfig files
This avoids paths in the top-level file getting out-of-sync, because the
.editorconfig files would be moved together with the files they target.
2025-05-07 20:01:35 +02:00
Vladimír Čunát
7aeb16e7ff Merge master into staging-next 2025-05-04 08:07:53 +02:00
Jörg Thalheim
211568d4fd lib.systems: add golang platform dialect (#403030) 2025-05-04 06:04:53 +02:00
nixpkgs-ci[bot]
7be7cc17c3 Merge master into staging-next 2025-05-02 18:05:12 +00:00
adisbladis
9338d924db lib.meta.availableOn: Return false if pkg parameter is null
To fix overriding packages that checks for platform compatibility, like pipewire.

`pipewire` contains the following logic to enable support for ldac depending on library platform compatibility:
```nix
ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt
```

Which is used later in the expression to create a Meson flag:
```nix
(lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport))
```

This means that attempting to build `pipewire` without `ldacbt` like:
```nix
pipewire.override {
  ldacbt = null;
}
```
will fail because the the Meson flag indicates the feature should be enabled, but the library is passed to `buildInputs` as `null`.
2025-05-02 19:01:17 +02:00
aleksana
e1828f9668 lib.systems: add golang platform dialect 2025-04-30 22:05:32 +08:00
K900
19e54b8a69 Merge remote-tracking branch 'origin/master' into staging-next 2025-04-30 07:14:48 +03:00
aleksana
06bb544356 lib.systems.inspect.patterns.isEfi: add loongarch 2025-04-29 22:50:31 +08:00
nixpkgs-ci[bot]
c376a565f9 Merge staging-next into staging 2025-04-24 18:04:57 +00:00
jopejoe1
13c1207a12 font-{alias,util}, gccmakedep, libp{ciacces,threadstub}s: refactor and migrate to pkgs/by-name from xorg namespace (#369520) 2025-04-24 19:11:58 +02:00
zowoq
0931f4e861 Revert "pkgs/top-level/stage.nix: add pkgsLLVMLibc"
This reverts commit 41b14024d2.
2025-04-24 14:04:25 +10:00
Johannes Kirschbauer
be393db73e lib.takeEnd: init (#398222) 2025-04-23 14:20:47 +02:00
Johannes Kirschbauer
bda0c8532b lib.getAttrFromPath: fix docs (#400948) 2025-04-23 14:09:23 +02:00
Pol Dellaiera
a9320986b3 lib.strings: init splitStringBy (#385643) 2025-04-23 04:51:38 +00:00
Silvan Mosberger
3ca8b685c8 lib.getAttrFromPath: fix docs 2025-04-22 23:39:18 +02:00
Zitrone
6638639684 font-util: refactored, moved to pkgs/by-name and renamed from xorg.fontutil 2025-04-22 19:46:53 +02:00
Zitrone
5d15a3d718 font-alias: refactored, moved to pkgs/by-name and renamed from xorg.fontalias 2025-04-22 19:46:52 +02:00
Norbert Melzer
b2f1b6b8f0 lib/strings: Zero‐pad hex digits in escapeC (#399722) 2025-04-21 17:12:55 +02:00
Johannes Kirschbauer
843af863e6 lib.options.mkPackageOption: use lib.showAttrPath (#398066) 2025-04-21 10:51:01 +02:00
Johannes Kirschbauer
013beed1db lib/types: check paths in pathWith with hasStorePathPrefix (#387304) 2025-04-21 10:45:23 +02:00
Mikael Voss
487a002c63 lib/strings: Zero‐pad hex digits in escapeC
lib.strings.escapeC produces single‐digit hexadecimal strings for
character values ≤ 15, which results in an ambiguity. If the following
character is a hex digit, it will be interpreted as being part of the
escape sequence.

systemd, which also relies on C‐style escape sequences, does not
decode single‐digit sequences at all, even if unambiguous.

Padding the hexadecimal string with "0" avoids this problem.
2025-04-18 13:41:53 +02:00
Thiago Kenji Okada
4a99dd0542 grayjay: init at 5 (#368427) 2025-04-18 11:53:55 +01:00
Matt Sturgeon
6107d48bcb lib.options.mkPackageOption: use lib.showAttrPath
Make use of `lib.showAttrPath` instead of manually doing `concatStringsSep "."`.

This means edge-cases such as the attr-path including names that are not
valid nix identifiers will be handled better.

See:
- https://nix.dev/manual/nix/2.26/language/identifiers
- https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.attrsets.showAttrPath
2025-04-13 20:54:13 +01:00
Matt Sturgeon
4c26f96059 lib/tests/modules: test all mkPackageOption cases
There were several test case options declared in `declare-mkPackageOption.nix`
that were not actually tested in `modules.sh`.
2025-04-13 20:54:12 +01:00
azahi
9fee9e7371 lib.takeEnd: init 2025-04-13 17:37:35 +03:00
K900
aece6a0c1f Merge remote-tracking branch 'origin/master' into staging-next 2025-04-11 21:17:42 +03:00
Robert Hensing
3e5af839c2 lib.types.submodule: Disable check during docs generation (#396907) 2025-04-11 19:12:32 +02:00
Alyssa Ross
904b79c696 lib.systems: force qemuArch to "aarch64" on aarch64
qemu architecture names are fixed — we're using uname here just
because it's more likely to be correct than CPU name (see e.g. POWER).
This means that aarch64 is always called aarch64, even on Darwin where
uname reports arm64.

Fixes: 61582c7043 ("lib/systems: use Darwin architecture names for `config` and `uname`")
2025-04-11 10:32:19 +02:00
nixpkgs-ci[bot]
c55a1a7779 Merge master into staging-next 2025-04-11 00:15:47 +00:00
Robert Hensing
e09cf9f066 lib.types.submodule: Disable check during docs generation
Put simply docs generation is a weird eval, and we should avoid
generating any unnecessary errors.
2025-04-11 00:32:01 +02:00
Robert Hensing
d84b0024f6 lib/modules: export class inside specialArgs (#395141) 2025-04-10 20:58:41 +02:00