Commit Graph

411 Commits

Author SHA1 Message Date
Felix Buehler
3106949fd7 lib/types: add externalPath 2025-11-04 22:57:16 +01:00
Robert Hensing
553d8e9ee9 doc/option-types: Improve union type docs 2025-10-28 18:47:45 +01:00
Felix Bühler
6ef6063ef6 pkgs.formats.plist: init (#448839) 2025-10-16 19:28:50 +00:00
Sizhe Zhao
93ab9d0a42 nixos/doc: add pkgs.formats.plist 2025-10-08 11:53:39 +08:00
nixpkgs-ci[bot]
2f8516c5ac Merge master into staging-next 2025-10-02 06:05:42 +00:00
h7x4
b7cdcad895 nixos/doc: add documentation for formats.pythonVars 2025-09-18 18:15:57 +02:00
Wolfgang Walther
b9ec8bed14 treewide: fix typos in md files (#439306) 2025-09-09 08:03:31 +00:00
Ben Siraphob
7b646b7f6d nixos: fix typos 2025-09-09 13:14:35 +07:00
Emily
3b7e7e362b haskell.compiler.ghc928: drop 2025-09-07 18:45:52 +01:00
Jared Baur
88a11a0dcd switch-to-configuration-ng: add more logging
Adds more logging to the non-systemd related parts of
switch-to-configuration.
2025-09-02 21:41:00 +01:00
Robert Hensing
d88b9464b0 system.services: Remove ambiguous, redundant pkgs module argument
Primary reasons: remove implicit dependencies and force uniformity.
See nixos/modules/system/service/README.md for detailed rationale.
2025-08-20 11:44:06 +02:00
Robert Hensing
0b9a1cb426 nixos/README-modular-services: init 2025-08-09 00:32:59 +02:00
Wolfgang Walther
fed181fac1 nixos/doc/modular-services: run nixfmt on code blocks 2025-08-05 17:08:45 +02:00
Robert Hensing
f5ee08446a Modular services (#372170) 2025-07-24 16:46:34 +02:00
Wolfgang Walther
62fe016519 treewide: run treefmt with mdcr/nixfmt 2025-07-24 13:52:31 +02:00
Wolfgang Walther
6c47e7d5da treewide: fix syntax errors in nix code blocks
Fixes all code blocks with "nix" language in markdown files for syntax
errors to be able to run nixfmt in the next step.
2025-07-24 13:52:29 +02:00
Maximilian Bosch
9372904a35 nixos/doc: clarify scope of debugHook feature in the test driver
As discussed with tfc before, it's probably better in most cases to try
the interactive test-driver with the SSH backdoor first and resort to
this feature for flaky tests.
2025-07-20 15:46:14 +02:00
Robert Hensing
1f4e476269 nixos/doc: Modular services introduction is formally 25.11
I think we should backport it nonetheless.
2025-07-20 03:19:28 +02:00
Robert Hensing
af04a80c76 modular-services: merge process.argv from executable and args 2025-07-20 03:01:06 +02:00
Robert Hensing
03c4d4bc66 nixos/doc/modular-services: Use package attr in example
Without a proper introduction it's really really hard to make sense of the examples, and where values come from; which are arbitrary, which are conventional, which are hard-coded into some part of the framework.

Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
2025-07-20 03:01:06 +02:00
Robert Hensing
7d7b678ed6 nixos/doc/modular-services: Explain configuration mgmt framework
Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
2025-07-20 03:01:06 +02:00
Robert Hensing
b7ded19010 nixos/doc: Add modular services section 2025-07-20 03:01:06 +02:00
Jacek Galowicz
d6b326d659 test-driver: Implement debugging breakpoint hooks
Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
2025-07-18 17:39:01 +02:00
Philip Taron
8279ffe622 treewide: specify that mebibytes are used when it's ambiguous (#424169) 2025-07-11 12:29:33 -07:00
Axel Karjalainen
7159ab6f43 treewide: specify where mebibytes are used when it's ambiguous 2025-07-11 00:44:23 +03:00
Robert Hensing
f2b3aeb383 nixos.runTest: Add extendNixOS 2025-07-06 13:39:15 +02:00
Robert Hensing
63e2606ddf nixos.runTest: Add extend, overrideTestDerivation 2025-07-06 13:39:15 +02:00
Maximilian Bosch
c6978e8a58 nixos/test-driver: exit early if /dev/vhost-vsock isn't available
Right now it wrongly seems as if you can set
`sshBackdoor.enable = true;` for each test and not only for debugging
purposes.

This is wrong however since you'd need to pass /dev/vhost-vsock into the
sandbox for this (which is also a prerequisite for #392117).

To make that clear, two things were changed:

* add a warning to the manual to communicate this.
* exit both interactive and non-interactive driver early if
  /dev/vhost-vsock is missing and the ssh backdoor is enabled.

  If that's the case, we pass a CLI flag to the driver already in the
  interactive case. This change also sets the flag for the
  non-interactive case.

  That way we also get a better error if somebody tries to enable this
  on a system that doesn't support that.
2025-05-13 11:14:13 +02:00
Jacek Galowicz
08ed87ccc6 nixos/test-driver: allow assigning other vsock number ranges (#405508) 2025-05-11 13:24:41 +02:00
Arnout Engelen
eb9ce0eed3 treewide: remove inactive maintainer ericsagnes 2025-05-09 12:03:09 +02:00
Maximilian Bosch
a9adfc631a nixos/test-driver: allow assigning other vsock number ranges
I'm a little annoyed at myself that I only realized this _after_ #392030
got merged. But I realized that if something else is using AF_VSOCK or
you simply have another interactive test running (e.g. by another user
on a larger builder), starting up VMs in the driver fails with

    qemu-system-x86_64: -device vhost-vsock-pci,guest-cid=3: vhost-vsock: unable to set guest cid: Address already in use

Multi-user setups are broken anyways because you usually don't have
permissions to remove the VM state from another user and thus starting
the driver fails with

    PermissionError: [Errno 13] Permission denied: PosixPath('/tmp/vm-state-machine')

but this is something you can work around at least.

I was considering to generate random offsets, but that's not feasible
given we need to know the numbers at eval time to inject them into the
QEMU args. Also, while we could do this via the test-driver, we should
also probe if the vsock numbers are unused making the code even more
complex for a use-case I consider rather uncommon.

Hence the solution is to do

    sshBackdoor.vsockOffset = 23542;

when encountering conflicts.
2025-05-09 11:54:00 +02:00
Jacek Galowicz
8b3baa1402 nixos/test-driver: add backdoor based on systemd-ssh-proxy & AF_VSOCK (#392030) 2025-05-09 08:03:55 +02:00
NotAShelf
ce5cf79e21 nixos/doc: fix typos in settings-options section 2025-05-01 19:20:22 +03:00
Maximilian Bosch
1bd8073958 nixos/test-driver: add backdoor based on systemd-ssh-proxy & AF_VSOCK
With this it's possible to trivially SSH into running machines from the
test-driver. This is especially useful when running VM tests
interactively on a remote system.

This is based on `systemd-ssh-proxy(1)`, so there's no need to configure
any additional networking on the host-side.

Suggested-by: Ryan Lahfa <masterancpp@gmail.com>
2025-04-26 11:35:47 +02:00
Jacek Galowicz
d0c304d4c1 nixos/test-driver: improve error reporting and assertions (#390996) 2025-04-26 10:26:01 +02:00
Morgan Jones
85fef808ad doc: init Testing Hardware Features section with vwifi 2025-04-20 15:39:25 -07:00
Martin Weinelt
f362195287 nixos/doc: update python39Packages reference
The packages set is now gone and pytorch has been renamed to just torch.
2025-04-13 01:26:42 +02:00
Johannes Kirschbauer
33daa3f4b9 lib.modules: init test for lib.mkDefinition 2025-04-03 15:03:00 +02:00
Johannes Kirschbauer
c906064af1 lib.modules: document mkDefinition section 2025-04-03 14:12:08 +02:00
Wolfgang Walther
9992c0fd4d doc/option-types: fix attrTag example
Further down, `ssh = { drop = {}; };` is used.
2025-03-27 14:22:53 +01:00
maryjane
a6f14a6036 nixos/doc: Fix outdated references in the NixOS manual 2025-03-25 19:51:54 +00:00
Maximilian Bosch
a1dfaf51e2 nixos/test-driver: integrate Python unittest assertions
Replaces / Closes #345948

I tried to integrate `pytest` assertions because I like the reporting,
but I only managed to get the very basic thing and even that was messing
around a lot with its internals.

The approach in #345948 shifts too much maintenance effort to us, so
it's not really desirable either.

After discussing with Benoit on Ocean Sprint about this, we decided that
it's probably the best compromise to integrate `unittest`: it also
provides good diffs when needed, but the downside is that existing tests
don't benefit from it.

This patch essentially does the following things:

* Add a new global `t` that is an instance of a `unittest.TestCase`
  class. I decided to just go for `t` given that e.g.
  `tester.assertEqual` (or any other longer name) seems quite verbose.

* Use a special class for errors that get special treatment:
  * The traceback is minimized to only include frames from the
    testScript: in this case I don't really care about anything else and
    IMHO that's just visual noise.

    This is not the case for other exceptions since these may indicate a
    bug and then people should be able to send the full traceback to the
    maintainers.
  * Display the error, but with `!!!` as prefix to make sure it's
    easier to spot in between other logs.

This looks e.g. like

    !!! Traceback (most recent call last):
    !!!   File "<string>", line 7, in <module>
    !!!     foo()
    !!!   File "<string>", line 5, in foo
    !!!     t.assertEqual({"foo":[1,2,{"foo":"bar"}]},{"foo":[1,2,{"bar":"foo"}],"bar":[1,2,3,4,"foo"]})
    !!!
    !!! NixOSAssertionError: {'foo': [1, 2, {'foo': 'bar'}]} != {'foo': [1, 2, {'bar': 'foo'}], 'bar': [1, 2, 3, 4, 'foo']}
    !!! - {'foo': [1, 2, {'foo': 'bar'}]}
    !!! + {'bar': [1, 2, 3, 4, 'foo'], 'foo': [1, 2, {'bar': 'foo'}]}
    cleanup
    kill machine (pid 9)
    qemu-system-x86_64: terminating on signal 15 from pid 6 (/nix/store/wz0j2zi02rvnjiz37nn28h3gfdq61svz-python3-3.12.9/bin/python3.12)
    kill vlan (pid 7)
    (finished: cleanup, in 0.00 seconds)

Co-authored-by: bew <bew@users.noreply.github.com>
2025-03-20 12:30:58 +00:00
Matt Sturgeon
2611d5bd70 formats.lua: init
Add a lua format, based on `lib.generators.toLua`.
2025-03-19 21:18:49 +00:00
Matt Sturgeon
c347d605c9 lib.types: add luaInline
Represents inline lua as expected by `lib.generators.toLua`, for
embedding raw lua expressions within structurally generated lua.
2025-03-15 10:29:28 +00:00
Peder Bergebakken Sundt
d525eb5838 treewide: fix typos
done with `fd \\\.md$ . --type f -x typos --write-changes`
2025-02-22 02:02:07 +01:00
Jeremy Fleischman
6d7f6a92cc lib/types: add types.pathWith
This gives people some flexibility when they need a path type, and
prevents a "combinatorial explosion" of various path stops.

I've re-implemented our existing `path` and `pathInStore` types using
`pathWith`. Our existing `package` type is potentially a candidate for
similar treatment, but it's a little quirkier (there's some stuff with
`builtins.hasContext` and `toDerivation` that I don't completely
understand), and I didn't want to muddy this PR with that.

As a happy side effect of this work, we get a new feature: the ability
to create a type for paths *not* in the store. This is useful for when a
module needs a path to a file, and wants to protect people from
accidentally leaking that file into the nix store.
2025-02-15 16:14:06 +07:00
Silvan Mosberger
4fbf6bf123 pkgs-lib.formats.xml: init (#342633) 2025-01-13 22:11:17 +01:00
Felix Buehler
a468405d67 pkgs-lib.formats.xml: init 2025-01-13 21:56:22 +01:00
Gavin John
ce02ad25ed doc/manual: replace bad advice about package options and overlays 2025-01-08 12:49:40 -08:00
uku
ccfeb0ac5b pkgs.formats: add documentation entry for CDN 2025-01-08 14:02:24 +01:00