summary refs log tree commit diff
path: root/nixos/lib
Commit message (Collapse)AuthorAge
* Revert "nixos/specialisation: Rephrase in terms of extendModules, noUserModules"Robert Hensing2021-11-01
| | | | | | | | | | | This reverts commit e2bea4427bcf03ae168e45e0bcbd92ac678d91ce. While this commit was probably fine, I want to be conservative with changes right before the release branch-off. So far the extendModules commits have been adding and refactoring expressions that did not affect derivation hashes, whereas this commit changes the module ordering. I will open a separate PR for it.
* nixos/specialisation: Rephrase in terms of extendModules, noUserModulesRobert Hensing2021-11-01
|
* nixos/eval-config.nix: Expose typeRobert Hensing2021-11-01
| | | | Also works for (pkgs.nixos {}).type.
* nixosTest: Fix infinite recursion involving hasContext testScript when ↵Robert Hensing2021-10-31
| | | | | | | | | | | | useNixStoreImage = true The involved test was nixosTests.nextcloud.basic21. It has a testScript that is strict in nodes.nextcloud.config.system.build.vm, in assertions about imagemagick being in the system closure. The recursion was introduced in 329a4461a7a1898b3aad13968a232a054422c4fb from https://github.com/NixOS/nixpkgs/pull/140792
* make-disk-image: Add an argument to only build a Nix store imagetalyz2021-10-28
| | | | | | Add the `onlyNixStore` argument which enables building images containing the contents of the Nix store at the root, instead of a full system.
* nixos/testing-python: Copy test script derivations to nodestalyz2021-10-28
| | | | | | | | | Make sure the all derivations referenced by the test script are available on the nodes. Accessing these derivations works just fine without this change when using 9p to mount the host's store, but when an image is built (virtualisation.buildRootImage), the dependencies need to be copied to the image. We don't want to copy the script itself, though, since that would trigger unnecessary image rebuilds.
* make-disk-image: Add additionalPaths argumenttalyz2021-10-28
| | | | | Add an argument which makes it possible to add additional paths to the image's nix store.
* make-disk-image: Add copyChannel argumenttalyz2021-10-28
| | | | | | | | Add a copyChannel argument which controls whether the current source tree will be made available as a nix channel in the image or not. Previously, it always was. Making it available is useful for interactive use of nix utils, but changes the hash of the image when the sources are updated.
* make-disk-image: Reintroduce the installBootLoader argumenttalyz2021-10-28
| | | | | | installBootLoader was removed in f1708a9d7d79e2bf2961fc648625578b23b3460f; probably by mistake, since only the logic was removed, not the argument.
* nixos/test-runner: Fix thread cleanupJanne Heß2021-10-24
|
* nixos/lib/test-driver: set defaults in __init__ instead of class levelK9002021-10-19
| | | | Just a minor code style nit to avoid potential footguns
* nixos/lib/test-driver: clean up threads correctlyK9002021-10-19
| | | | | | | | | | | | The current implementation just forks off a thread to read QEMU's stdout and lets it exist forever. This, however, makes the interpreter shutdown racy, as the thread could still be running and writing out buffered stdout when the main thread exits (and since it's using the low level API, the worker thread does not get cleaned up by the atexit hooks installed by `threading`, either). So, instead of doing that, let's create a real `threading.Thread` object, and also explicitly `join` it along with the other stuff when cleaning up.
* Merge pull request #142040 from pennae/optimize-module-docsDomen Kožar2021-10-18
|\ | | | | make-options-docs: don't sort the options XML file
| * make-options-docs: don't sort the options XML filepennae2021-10-18
| | | | | | | | | | | | | | | | we need the file itself as a dependency for the docbook build, but we don't need it to be properly sorted at the nix level. push the sort out to a python script instead to save eval time. on the machine used to write this `nix-instantiate <nixos/nixos> -A system` went down from 7.1s to 5.4s and GC heap size decreased by 50MB (or 70MB max RSS).
* | nixosTest: Provide system.build.networkConfigRobert Hensing2021-10-17
|/
* nixos/test-runner: Print exceptions that happenJanne Heß2021-10-14
|
* Merge pull request #112823 from deviant/nixos-boot-pathsKim Lindberger2021-10-07
|\ | | | | nixos/boot: add /var/lib/nixos to pathsNeededForBoot
| * nixos/boot: add /var/lib/nixos to pathsNeededForBootV2021-02-11
| | | | | | | | | | | | | | | | | | /var/lib/nixos is used by update-users-groups.pl in the activation script for storing uid/gid mappings. If this has its own mountpoint (as is the case in some setups with fine-grained bind mounts pointing into persistent storage), the mappings are written to /var/lib, /var, or /. These may be backed by a tmpfs or (otherwise ephemeral storage), resulting in the mappings not persisting between reboots.
* | Merge pull request #126713 from ↵Jacek Galowicz2021-10-07
|\ \ | | | | | | | | | | | | blaggacao/nixos-test-ref/05-class-ify-test-driver nixos test ref/05 class ify test driver
| * | Re-RAII-ify the NixOS integration test driver's VLAN class.Jacek Galowicz2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | | We have no usecase for manually/selectively starting or stopping VLANs in integration tests. By starting and stopping the VLANs with the constructor and destructor of VLAN objects, we remove the obligation and complexity to maintain network lifetime separately.
| * | nixos/test-driver: fix graphics for VMMaximilian Bosch2021-10-05
| | | | | | | | | | | | | | | | | | `-nographic` should only be set if no display is available. Otherwise, tools such as `nixos-build-vms(8)` will never open up a graphical display.
| * | nixos/test/test-driver: Class-ify the test driverDavid Arnold2021-10-05
| | | | | | | | | | | | | | | | | | | | | This commit encapsulates the involved domain into classes and defines explicit and typed arguments where untyped dicts where used. It preserves backwards compatibility through legacy wrappers.
* | | nixos/lib/make-options-doc: implement literalDocBookNaïm Favier2021-10-03
| | |
* | | nixos/lib/qemu-flags: rename to qemu-commonrnhmjoj2021-09-18
| | | | | | | | | | | | | | | | | | The current name is misleading: it doesn't contain cli arguments, but several constants and utility functions related to qemu. This commit also removes the use of `with import ...` for clarity.
* | | nixos/qemu: add types to all optionsrnhmjoj2021-09-18
| | |
* | | nixos/qemu: fix several shellcheck issuesrnhmjoj2021-09-18
| | | | | | | | | | | | | | | - Fix shell quoting issues - Fix unsafe cd in run-machine-vm script
* | | nixos/testing: remove unused function runInMachineMatthew Kenigsberg2021-09-08
|/ / | | | | | | | | runInMachine and runInMachineWithX are not used for any tests and can be removed
* | nixos/make-zfs-image: initGraham Christensen2021-08-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a private interface for internal NixOS use. It is similar to `make-disk-image` except it is much more opinionated about what kind of disk image it'll make. Specifically, it will always create *two* disks: 1. a `boot` disk formatted with FAT in a hybrid GPT mode. 2. a `root` disk which is completely owned by a single zpool. The partitioning and FAT decisions should make the resulting images bootable under EFI or BIOS, with systemd-boot or grub. The root disk's zpools options are highly customizable, including fully customizable datasets and their options. Because the boot disk and partition are highly opinionated, it is expected that the `boot` disk will be mounted at `/boot`. It is always labeled ESP even on BIOS boot systems. In order for the datasets to be mounted properly, the `datasets` passed in to `make-zfs-image` are turned in to NixOS configuration stored at /etc/nixos/configuration.nix inside the VM. NOTE: The function accepts a system configuration in the `config` argument. The *caller* must manually configure the system in `config` to have each specified `dataset` be represented by a corresponding `fileSystems` entry. One way to test the resulting images is with qemu: ```sh boot=$(find ./result/ -name '*.boot.*'); root=$(find ./result/ -name '*.root.*'); echo '`Ctrl-a h` to get help on the monitor'; echo '`Ctrl-a x` to exit'; qemu-kvm \ -nographic \ -cpu max \ -m 16G \ -drive file=$boot,snapshot=on,index=0,media=disk \ -drive file=$root,snapshot=on,index=1,media=disk \ -boot c \ -net user \ -net nic \ -msg timestamp=on ```
* | nixos/test: some test fixes in succession of #125992David Arnold2021-08-20
| |
* | nixos/tests/test-driver: better control test env symbolsDavid Arnold2021-08-19
| | | | | | | | | | | | | | | | | | Previous to this commit, the entire test driver environment was shared with the actual python test environment. This is a hefty api surface. This commit selectively exposes only those symbols to the test environment that are actually meant to be used by tests.
* | Merge pull request #133675 from Ma27/test-driver-compatMaximilian Bosch2021-08-16
|\ \ | | | | | | nixos/test-driver: minor fixes for `nixos-build-vms(8)`
| * | nixos/testing: only create `nixos-run-vms` for `nixos-build-vms(8)`Maximilian Bosch2021-08-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the case when the test-script is empty. `nixos-build-vms(8)` is primarily supposed to be used as tool to test changes or to reproduce bugs (IMHO) where "just spinning up a few VMs" is the primary use-case. In the ongoing discussion about these changes[1] it was suggested to only expose it when needed (i.e. in the case I described above) to keep the API surface as slim as possible. [1] https://github.com/NixOS/nixpkgs/pull/133675#discussion_r688112485
| * | nixos/test-driver: start interactive mode if `testScript` is emptyMaximilian Bosch2021-08-12
| | | | | | | | | | | | | | | | | | This is relevant for `nixos-build-vms(8)` which doesn't have a test-script. In that case it's more intuitive to directly go into the interactive mode which is IMHO more intuitive.
| * | nixos/testing: re-add nixos-run-vms scriptMaximilian Bosch2021-08-12
| | | | | | | | | | | | | | | Originally removed in 926fb9396881202e727e5ec1fbf609b64455b388. This one is actually quite useful for `nixos-build-vms(8)`.
* | | treewide: runCommandNoCC -> runCommandRobert Hensing2021-08-15
|/ / | | | | | | This has been synonymous for ~5y.
* | Merge pull request #125979 from ↵lewo2021-08-08
|\ \ | | | | | | | | | | | | blaggacao/nixos-test-ref/03-normalse-the-python-entrypoint nixos/test-driver: normalize the python entrypoint
| * | nixos/tests/test-driver: normalise test driver entrypoint(s)David Arnold2021-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the driver was configured exclusively through convoluted environment variables. Now the driver's defaults are configured through env variables. Some additional concerns are in the github comments of this PR.
* | | nixos/testing: fix invalid node names detectionDavid Arnold2021-07-28
|/ / | | | | | | | | | | | | | | | | | | | | | | | | the use of python further restricts possible RFC1035 host labels since dash is not allowed for use in python identifiers. The previous implementation of this check was flawed, since it did not check the `hostName` value that is actually used to construe the identifier, but the node name, which can be anything, e.g. just `machine`. The previous implementation, by further restricting RFC1035 labels, only for the sake of testing seems to be an unacceptable restriction and should be addressed separately.
* | tigervnc, tightvnc: add basic testsIngo Blechschmidt2021-07-20
| | | | | | | | Co-Authored-By: Ingo Blechschmidt <iblech@web.de>
* | nixos/test-driver: allow overriding qemu binary in create_startcommandmisuzu2021-07-14
| |
* | Merge pull request #127744 from cransom/disk-image-fasterRobert Hensing2021-06-26
|\ \ | | | | | | make-disk-image: Reduce forking
| * | make-disk-image: Reduce forkingCasey Ransom2021-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The disk image calculator was using find + exec forking du for every file in the disk image, making it very slow. Change du to accept files, nul delimeted on stdin to speed it back up. Before change: nix-build nixos/tests/image-contents.nix 9.71s user 1.06s system 8% cpu 2:13.11 total After change: nix-build nixos/tests/image-contents.nix 9.93s user 1.23s system 21% cpu 51.601 total
* | | nixos/test-driver: replace termlib with socatJörg Thalheim2021-06-22
|/ / | | | | | | | | telnetlib does not handle unicode, which is annoying when using systemctl. Also this gives us a nice readline with history.
* | nixosTest: Force system.nixos.revision constantDavid Arnold2021-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | nixos tests are blended with other system configurations, hence their settings must be either enforced or defaulted. This particular setting is set via lib.nixosSystem as `system.nixos.revision = final.mkIf (self ? rev) self.rev;` which would mean that without this change no flake generated nixos could be blended with nixos testing. This setting was made previously constant in 169c6b4b1478a3a0c823c99ea39d4082f76a2708 in order to avoid pointless rebuilds of the testing VMs, but was set without enforcing it.
* | Merge pull request #127309 from jakobrs/nixos-normalise-nullKim Lindberger2021-06-18
|\ \ | | | | | | Resolve evaluation failure when filesystem device option is null
| * | nixos/lib: Handle null `device` correctlyjakobrs2021-06-18
| | |
* | | nixos/test-driver: Fix passing passthru attributeaszlig2021-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently this looks like it was forgotten when doing commit 3884ff70badca0c93c717e6190946a9a2846e948, which refactored the test runner and driver a bit. The passthru argument actually was correctly reintroduced in setupDriverForTest, but the actual makeTest function didn't use it. This fixes the nixpkgs tarball job, which previously failed with: attribute 'elkPackages' missing, at /build/source/pkgs/tools/misc/logstash/6.x.nix:58:30 Signed-off-by: aszlig <aszlig@nix.build> Acked-by: David Arnold <dar@xoe.solutions> Fixes: https://github.com/NixOS/nixpkgs/issues/127274 Merges: https://github.com/NixOS/nixpkgs/pull/127346
* | | Merge pull request #125973 from ↵Jacek Galowicz2021-06-16
|\ \ \ | | | | | | | | | | | | | | | | blaggacao/nixos-test-ref/02-normalise-test-driver-nix-expressions nixos test ref/02 normalise test driver nix expressions
| * | | nixos/tests/test-driver: cleanup nix expressionDavid Arnold2021-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Less nesting, where that improves readability. More nesteing, where that improves readability, but most importantly: Expose individual functions separately so that they can be more easily built directly, eg.: `nix build --impure --expr '(import ./testing-python.nix {system = builtins.currentSystem;}).mkTestDriver'`
* | | | Merge pull request #86967 from jakobrs/more-general-fsbeforeKim Lindberger2021-06-14
|\ \ \ \ | |/ / / |/| / / | |/ / nixos/lib/utils: Add `fileSystems.<name>.depends` option and generalise fsBefore (fixes #86955)