Commit Graph

5275 Commits

Author SHA1 Message Date
Eman Resu
d55c01c37d lib/systems/inspect: partially apply hasPrefix 2026-07-20 10:29:40 -04:00
Eman Resu
9a3a330251 lib.strings.hasInfix: partially apply match for infix 2026-07-20 10:28:42 -04:00
Eman Resu
131d2ecd4a lib.strings.hasPrefix: partially apply substring calls 2026-07-20 10:28:42 -04:00
cinereal
ae9994806c lib/services: fix reload/readiness bugs and add compliance coverage
Fixes several correctness bugs primarily around modular services' recent
reload/notification options (#535695) and adds compliance coverage to guard them.

Fixes:

- `lib/services/service.nix`:
  - the reload-conflict assertion had inverted polarity, so it fired on the
    default configuration
  - the `mkIf` guard on `process.reloadCommand` had a misplaced paren, applying
    `!= null` to the `mkIf` result rather than to the condition
  - `process.reloadSignal` derives `process.reloadCommand`, so the assertion
    could not check `reloadCommand != null` -- that fired on every signal-only
    service. The command is now derived at `mkDefault` priority and the
    assertion is gated on `options.process.reloadCommand.highestPrio`, firing
    only when the user also set `reloadCommand` explicitly.
  - change `notificationProtocol` to a sub-module type
- `nixos/modules/system/service/systemd/service.nix`:
  - `systemd.mainExecReload`'s default ran `escapeSystemdExecArgs` (a list
    escaper) on the `nullOr str` `process.reloadCommand`; this threw
    `expected a list but found a string` and would have mangled `$MAINPID`. It
    now uses `process.reloadCommand` verbatim.
  - the `Type` default read a non-existent
    `config.serviceManager.notificationProtocol` instead of
    `config.notificationProtocol`.

Tests:

Extend the modular-service compliance suite to guard the above:

- Portable (manager-agnostic) eval assertions: `reloadSignal` derives
  `reloadCommand`, the conflict assertion does not fire on signal-only services
  but does when both are set explicitly, and `notificationProtocol.systemd`/`.s6`
  default to `false`.
- systemd-specific eval assertions: `serviceConfig.Type` (simple/notify) and
  `serviceConfig.ExecReload` are asserted on the resolved host units. This
  directly guards the `mainExecReload` fix, which threw before it.
- Runtime reload compliance test: a nested reloadable sub-service is started and
  reloaded, asserting the service observed the reload (recorded a SIGHUP marker).
  `callReload` receives the service's name path (the list of names from the
  top-level service down to the target sub-service); each integration joins it
  per its own unit-naming convention (NixOS dash-joins to the systemd unit name,
  e.g. `reload-inner.service`). Keeping it a path list rather than a read-only
  submodule option keeps the suite manager-agnostic.
- `doc/build-helpers/testers.chapter.md`: document `callReload`.

Follow-up to #535695.

Signed-off-by: cinereal <cinereal@riseup.net>
Assisted-by: Claude:claude-opus-4-8
2026-07-20 11:01:04 +02:00
Jo
d97f35d9a4 celestia: 1.6.4 -> 1.6.4-unstable-2026-07-02 (#540555) 2026-07-16 10:29:26 +00:00
Johannes Kirschbauer
3436493e89 doc: fix malformed fenced divs (#541946) 2026-07-16 10:14:26 +00:00
jopejoe1
8a29e58f76 lib.licenses: drop llgpl21
This is just a combination of lgpl21 and llgpl licenses
2026-07-16 11:59:03 +02:00
jopejoe1
ee282178bf lib.licenses: add llgplPreamble 2026-07-16 11:59:03 +02:00
jopejoe1
dcceb50b55 lib.licenses: add bugroff
Added to spdx in https://github.com/spdx/license-list-XML/pull/3037
2026-07-16 11:59:03 +02:00
jopejoe1
89be98d540 lib.licenses.stk: use upstream spdx info 2026-07-16 09:37:39 +02:00
Alyssa Ross
cfa7d6949d wordnet: make use of lib.licenses.wordnet (#540729) 2026-07-15 11:36:44 +00:00
Alyssa Ross
774a1363f6 buddy: change license to lib.licenses.buddy (#540731) 2026-07-15 11:36:02 +00:00
pancaek
0d7517afd3 lib/licenses: add CC-BY-NC-3.0-IGO and JPL-image licenses 2026-07-14 21:43:12 -07:00
Ryan Mulligan
35260ee51a doc: fix additional malformed fenced divs 2026-07-14 14:03:26 -07:00
Ryan Mulligan
d875aae529 doc: fix mmdoc fenced div rendering 2026-07-14 14:02:36 -07:00
Malix - Alix Brunet
fa23725d3b options: mkOption docs update 2026-07-14 13:36:34 +02:00
Jo
c4a4f9aaff ngrep: make use of lib.licenses (#540728) 2026-07-14 08:40:57 +00:00
cinereal
608690995f nixos/modular-services: add portable process.environment
Adds modular service option `process.environment` to pass an attrset of
env vars to the service manager.
`null` values actively unset the variable before the process starts.

Values are `coercedTo (either path package) str` via interpolation,
mirroring `pathOrStr`, so paths and packages render to store-path strings
with string context preserved. The type is `lazyAttrsOf`, allowing one
entry to reference another (recursive env definitions).

The systemd backend unsets entries using `unexport` in `ExecStart`,
so the variable is absent even when `Environment=` or
the inherited environment would otherwise supply it.

The systemd backend lifts non-null entries onto the primary unit wrapped
per-key with `lib.mkDefault` so they merge with the existing priority-100
`environment.PATH` binding in `nixos/lib/systemd-lib.nix` while still letting
explicit `systemd.service.environment.<k>` overrides win.

The systemd extra-root modules are loaded via `importApply`, closing `pkgs`
over `systemd/service.nix` as a non-module argument (matching the portable
`lib/services/service.nix` convention) instead of passing a redundant `pkgs`
specialArg. The docs eval threads `pkgs = throw` accordingly.

Portable coverage lives in `testers.modularServiceCompliance`: an eval-level
check that a set value round-trips and a `null` value is preserved, plus an
integration test that records the service's own `/proc/$$/environ` and asserts
the set variable is present and the null variable is absent. The
systemd-specific grep assertions in `systemd/test.nix` cover how systemd
achieves this (`Environment=` rendering, null filtering, the `unexport`
wrapper, and override precedence).

Assisted-by: Claude:claude-opus-4-8
2026-07-11 22:54:46 +02:00
Bjørn Forsman
a15b1f5f01 t1utils: use lib.licenses.mit-click (#540726) 2026-07-11 17:26:01 +00:00
Aaron Andersen
fa6488337a lib/services: add some generalization options (#535695) 2026-07-11 12:26:04 +00:00
jopejoe1
69b4b1d0c0 lib.licenses: add wordnet 2026-07-11 13:48:47 +02:00
jopejoe1
4b55fc928b lib.licenses: add ogluk30 2026-07-11 13:45:38 +02:00
jopejoe1
7757c50b02 lib.licenses: add ngrep 2026-07-11 13:44:33 +02:00
jopejoe1
40a92d9a24 lib.licenses: add mit-click 2026-07-11 13:43:10 +02:00
jopejoe1
9c089e7a30 lib.licenses: add buddy 2026-07-11 13:41:51 +02:00
zowoq
5623c90edc lib/tests/misc: use x86_64-freebsd instead of x86_64-darwin (#535512) 2026-07-11 02:37:35 +00:00
eveeifyeve
aae4936e07 lib/services: add reload support for service management 2026-07-11 04:21:03 +10:00
eveeifyeve
03deb31b6b lib/services: add service readiness protocol support 2026-07-11 04:21:03 +10:00
nixpkgs-ci[bot]
5b0a62639f Merge master into staging-next 2026-07-08 06:51:14 +00:00
Amaan Qureshi
7e81743aa6 lib.systems: add GOARCH for big-endian mips64 2026-07-07 15:30:40 -04:00
Ben Siraphob
45ecf43c51 lib.meta-types: add binary either/both combinators
Every in-tree union/intersection use has exactly two members, and the
binary form verifies without allocating a closure or calling the any/all
primop per check. check-meta.nix switches to either/both; union and
intersection are kept for potential future use.

Assisted-by: Claude Code (Claude Fable 5)
2026-07-07 09:40:17 -07:00
Eman Resu
25a7ae8e4c lib.platforms: move primary systems to the beginning of the list 2026-07-04 09:36:48 -04:00
nixpkgs-ci[bot]
0e1056cb37 Merge master into staging-next 2026-07-02 14:28:02 +00:00
Matt Sturgeon
c00644f728 Module system types.attrTag implement declaration info in options (#531031) 2026-07-02 12:38:20 +00:00
nixpkgs-ci[bot]
c5a80d8625 Merge master into staging-next 2026-07-01 18:40:23 +00:00
yaya
53cd6f263c lib/trivial: Bump oldestSupportedRelease to 2605
NixOS 25.11 is end-of-life.
2026-07-01 14:01:54 +02:00
nixpkgs-ci[bot]
b53cb02803 Merge master into staging-next 2026-07-01 07:31:55 +00:00
Eman Resu
ed29e1b031 lib.strings: remove throwIfNot usage
throwIfNot sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:27 -04:00
Eman Resu
bb50241c60 lib.modules: remove throwIfNot usage
throwIfNot sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:26 -04:00
Eman Resu
e1ae8a8194 lib.gvariant.mkArray: refactor 2026-06-30 21:38:26 -04:00
Eman Resu
feb74fca37 lib.gvariant: remove throwIfNot usage
throwIfNot sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:26 -04:00
Eman Resu
079b1a7d07 lib.derivations: remove throwIfNot usage
throwIfNot sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:26 -04:00
Eman Resu
44eafb2953 lib.types: remove throwIf usage
throwIf sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:25 -04:00
Eman Resu
dd6f1736b7 lib.gvariant: remove throwIf usage
throwIf sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:25 -04:00
Eman Resu
c81b12b698 lib.fetchers: remove throwIf usage
throwIf sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:25 -04:00
Eman Resu
ce99cfa103 lib.types: remove assertMsg usage
assertMsg sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:25 -04:00
Eman Resu
855f2d0435 lib.strings: remove assertMsg usage
assertMsg sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:24 -04:00
Eman Resu
4ff2645579 lib.path: remove assertMsg usage
assertMsg sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:24 -04:00
Eman Resu
a017ab10eb lib.network: remove assertMsg usage
assertMsg sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:24 -04:00
Eman Resu
1e47a49c79 lib.meta: remove assertMsg usage
assertMsg sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
2026-06-30 21:38:23 -04:00