aboutsummaryrefslogtreecommitdiff
path: root/nixos/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* utillinux: rename to util-linuxGraham Christensen2020-11-241-2/+2
|
* nixos test-driver: fix single line docstrings, fixes #104467Frederik Rietdijk2020-11-211-4/+2
| | | | | Single line docstrings should have the """ on a single line according to PEP 8. It seems support for this landed in the latest version of Black.
* nixos: use nativeBuildInputs in make- iso9660-image and system-tarballEmery Hemingway2020-11-182-2/+2
| | | | | The tools used to create iso9660 images and tarballs are independent of the platform of the closure contained within.
* make-disk-image: support legacy+gptGraham Christensen2020-10-301-1/+15
|
* nixos/tests: fix wrong inherit that passes on the nodes attrsAndreas Rammhold2020-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hydra tarball step would fail due to the nodes attribute not being properly inherited. Since we can't execute all the tests and release steps locally anymore (thanks to the JSONification and faster hydra eval) these errors will probably keep in appearing. This is hopefully the last of those introduced by me test runner refactoring. Error was seen on hydra (https://hydra.nixos.org/build/129282411): > unpacking sources > unpacking source archive /nix/store/bp95x52h6nv3j8apxrryyj2rviw682k1-source > source root is source > patching sources > autoconfPhase > No bootstrap, bootstrap.sh, configure.in or configure.ac. Assuming this is not an GNU Autotools package. > configuring > release name is nixpkgs-21.03pre249116.1088f059401 > git-revision is 1088f059401c43450ed85e4a4ec3f57dc8aa992f > building > no Makefile, doing nothing > running tests > warning: you did not specify '--add-root'; the result might be removed by the garbage collector > warning: you did not specify '--add-root'; the result might be removed by the garbage collector > checking Nixpkgs on i686-linux > checking Nixpkgs on x86_64-linux > checking Nixpkgs on x86_64-darwin > checking eval-release.nix > trace: `mkStrict' is obsolete; use `mkOverride 0' instead. > trace: `lib.nixpkgsVersion` is deprecated, use `lib.version` instead! > trace: warning: lib.readPathsFromFile is deprecated, use a list instead > trace: Warning: `showVal` is deprecated and will be removed in the next release, please use `traceSeqN` > trace: lib.zip is deprecated, use lib.zipAttrsWith instead > checking find-tarballs.nix > trace: `mkStrict' is obsolete; use `mkOverride 0' instead. > trace: `lib.nixpkgsVersion` is deprecated, use `lib.version` instead! > trace: warning: lib.readPathsFromFile is deprecated, use a list instead > trace: Warning: `showVal` is deprecated and will be removed in the next release, please use `traceSeqN` > trace: lib.zip is deprecated, use lib.zipAttrsWith instead > error: while evaluating anonymous function at /build/source/maintainers/scripts/find-tarballs.nix:6:1, called from undefined position: > while evaluating 'operator' at /build/source/maintainers/scripts/find-tarballs.nix:27:16, called from undefined position: > while evaluating 'immediateDependenciesOf' at /build/source/maintainers/scripts/find-tarballs.nix:39:29, called from /build/source/maintainers/scripts/find-tarballs.nix:27:44: > while evaluating anonymous function at /build/source/lib/attrsets.nix:234:10, called from undefined position: > while evaluating anonymous function at /build/source/maintainers/scripts/find-tarballs.nix:40:37, called from /build/source/lib/attrsets.nix:234:16: > while evaluating 'derivationsIn' at /build/source/maintainers/scripts/find-tarballs.nix:42:19, called from /build/source/maintainers/scripts/find-tarballs.nix:40:40: > while evaluating 'canEval' at /build/source/maintainers/scripts/find-tarballs.nix:48:13, called from /build/source/maintainers/scripts/find-tarballs.nix:43:9: > while evaluating the attribute 'nodes' at /build/source/nixos/lib/testing-python.nix:195:23: > attribute 'nodes' missing, at /build/source/nixos/lib/testing-python.nix:193:16 > build time elapsed: 0m0.122s 0m0.043s 17m51.526s 0m56.668s > builder for '/nix/store/96rk3c74vrk6m3snm7n6jhis3j640pn4-nixpkgs-tarball-21.03pre249116.1088f059401.drv' failed with exit code 1
* nixos/tests: fix runInMachineAndreas Rammhold2020-10-251-1/+1
| | | | | | In 5500dc8 we introduced the --keep-vm-state flag and defaulted to that flag not being set. This lead to the `runInMachine` tests not longer working and that going unnoticed for quite some time now.
* nixos/tests: fix testDriver reference in runInMachine functionAndreas Rammhold2020-10-251-1/+2
| | | | | In a previous commit I broke this as there is no longer one testDriver but only a function to generate one based on some QEMU inputs.
* nixos/tests: format the testing-python.nix file more consistenlyAndreas Rammhold2020-10-251-98/+106
|
* nixos/tests: restructure test driver so that QEMU is actually overridenAndreas Rammhold2020-10-251-31/+48
| | | | | | | | | | | | | | Previously you would be able to override only the QEMU package to be used in the test runner. Frankly that doesn't help a lot if you are trying to get a graphical session. The graphical session requires the option in the NixOS module system to bet set to the correct QEMU package. In this commit I moved most of the test node configuration and transformations into the `mkDriver` function (previously called `driver`). The motivation was to be able to create a `driver` instance with a given QEMU package that will be used consistently througout the test expression.
* test-driver.py: remove bufsize=1 from Popen callsKonrad Borowski2020-10-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | According to Python documentation [0], `bufsize=1` is only meaningful in text mode. As we don't pass in an argument called `universal_newlines`, `encoding`, `errors` or `text` the file objects aren't opened in text mode, which means the argument is ignored with a warning in Python 3.8. line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used This commit removes this warning that appared when using interactive test driver built with `-A driver`. This is done by removing `bufsize=1` from Popen calls. The default parameter when unspecified for `bufsize` is `-1` which according to the documentation will be interpreted as `io.DEFAULT_BUFFER_SIZE`. As mentioned by a warning, Python already uses default buffer size when providing `buffering=1` parameter for file objects not opened in text mode. [0]: https://docs.python.org/3/library/subprocess.html#subprocess.Popen
* nixos: fix qemu_test being used in normal VMsrnhmjoj2020-10-211-4/+0
| | | | This is an attempt to fixup PR #49403.
* nixos/tests: expose both the interactive and non-interactive driverAndreas Rammhold2020-10-191-1/+2
| | | | | | For a lot of the work the non-interactive drivers are enough and it is probably a good idea to keep it accessible for debugging without touching the Nix expression.
* nixos/tests: make the `driver` attribute use a rich qemuAndreas Rammhold2020-10-191-6/+13
| | | | | | | | | | | | | Since we previously stripped down the features of `qemu_test` some of the features users are used to while running tests through the (impure) driver didn't work anymore. Most notably we lost support for graphical output and audio. With this change the `driver` attribute uses are more feature complete version of QEmu compared to the one used in the pure Nix builds. This gives us the best of both worlds. Users are able to see the graphical windows of VMs while CI and regular nix builds do not have to download all the (unnecessary) dependencies.
* nixos/{containers,cri-o,podman}: move copyFile to nixos/lib/utilszowoq2020-09-241-0/+5
|
* nixos/testing: Add support for specialArgsJanne Heß2020-09-142-4/+8
| | | | | | | Since using flakes disallows the usage of <unstable> (which I use in some tests), this adds an alternative. By setting specialArgs, all VMs can get the `unstable` flake input as an arg. This is not possible with extraConfigurations, as that would lead to infinite recursions.
* test-driver.py: defaulting keepVmState in Machine initFélix Baylac-Jacqué2020-09-111-1/+1
| | | | | | | | | | | | | | ecb73fd5557d6d438aa7c155e5b1aad89373c6ae introduced a new keepVmState CLI flag for test-driver.py. This CLI flags gets forwarded to the Machine class through create_machine. It created a regression for the boot tests where __main__ end up not being evaluated. See https://github.com/NixOS/nixpkgs/pull/97346#issuecomment-690951837 for bug report. Defaulting keepVmState to false when __main__ ends up not being evaluated.
* test-driver.py: fix VM state directory deletionFélix Baylac-Jacqué2020-09-071-9/+12
| | | | | | | | | | | | | | | | | | | | | The previous version of the code would only kick in if the state directory path pointed at a *file*, which never occurs. Making that codepath actually work reveals an ordering bug, which this patch fixes as well. It also replaces the confusing, imperative case log message "delete VM state directory" with "deleting VM state directory". Finally, we hint the user about how to prevent this deletion. IE. by passing the --keep-vm-state flag. Bug report: https://github.com/NixOS/nixpkgs/pull/91046#issuecomment-685568750 Credit goes to Edef for the rebase on top of a recent nixpkgs commit and for writing most of this commit message. Co-authored-by: edef <edef@edef.eu>
* nixos/testing: remove remaining coverage-data logicFlorian Klink2020-09-051-8/+1
| | | | | This isn't used anymore as per https://github.com/NixOS/nixpkgs/pull/72354#discussion_r451031449.
* Merge pull request #96042 from rnhmjoj/loaOfWORLDofPEACE2020-09-021-1/+1
|\ | | | | treewide: completely remove types.loaOf
| * nixos/lib/make-options-doc: remove loaOf subsrnhmjoj2020-09-021-1/+1
| | | | | | | | | | Remove the substitution for the <name?> placeholder used by loaOf, now that the type has been deprecated.
* | Revert "Merge pull request #96254 from Mic92/logging"Anders Kaseorg2020-08-302-145/+222
| | | | | | | | | | | | | | | | | | This reverts commit 4fc708567f6d9cf28f9ba426702069aa5a0b89c2, reversing changes made to 0e54f3a6d8393c31cfae43316904375dcfc77a46. Fixes #96699. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
* | Revert "Merge pull request #96152 from JJJollyjim/colour-test-machines-staging"Anders Kaseorg2020-08-301-13/+2
| | | | | | | | | | | | | | | | | | | | This reverts commit 1bff6fe17cbf3e81fbd4122af41d77ea378f45d7, reversing changes made to 2995fa48cb4878756b9d64b27535737278d96f07. There’s presumably nothing wrong with this PR, except that it conflicts with reverting #96254 which broke several tests (#96699). Signed-off-by: Anders Kaseorg <andersk@mit.edu>
* | nixos/test-driver: Use guest time when using sleepaszlig2020-08-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the Perl driver, machine.sleep(N) was doing a sleep on the guest machine instead of the host machine. The new Python test driver however uses time.sleep(), which instead sleeps on the host. While this shouldn't make a difference most of the time, it *does* however make a huge difference if the test machine is loaded and you're sleeping for a minimum duration of eg. an animation. I stumbled on this while porting most of all my tests to the new Python test driver and particularily my video game tests failed on a fairly loaded machine, whereas they don't with the Perl test driver. Switching the sleep() method to sleep on the guest instead of the host fixes this. Signed-off-by: aszlig <aszlig@nix.build>
* | nixos/lib/test*: remove perl test driverFlorian Klink2020-08-274-1258/+0
| | | | | | | | | | This has been deprecated in 20.03, and all tests have been migrated to the python framework, effectively making this dead code.
* | nixos/test: colour machine namesJamie McClymont2020-08-271-2/+13
| |
* | Merge pull request #96254 from Mic92/loggingJörg Thalheim2020-08-262-222/+145
|\ \
| * | nixos/test-driver: re-introduce log()Jörg Thalheim2020-08-251-0/+3
| | | | | | | | | | | | Appearantly this is used in tests
| * | nixos/testdriver: sort importsJörg Thalheim2020-08-251-7/+8
| | |
| * | nixos/test-driver: switch to pythons' logging libJörg Thalheim2020-08-252-215/+128
| | | | | | | | | | | | | | | - Less code - more thread-safe according to @flokli
| * | nixos/test-driver: introduce main methodJörg Thalheim2020-08-251-2/+8
| | | | | | | | | | | | | | | This way we not accidentally use introduce/use global variables. Also it explictly mark the code for the mypy type checker.
* | | Merge pull request #95956 from matthewbauer/qemu-cpu-maxMatthew Bauer2020-08-261-2/+2
|\ \ \ | |/ / |/| | runInLinuxVM, test-driver: use -cpu max instead of -cpu host
| * | runInLinuxVM, test-driver: use -cpu max instead of -cpu hostMatthew Bauer2020-08-211-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This appears to avoid requiring KVM when it’s not available. This is what I originally though -cpu host did. Unfortunately not much documentation available from the QEMU side on this, but this appears to square with help: $ qemu-system-x86 -cpu help ... x86 host KVM processor with all supported host features x86 max Enables all features supported by the accelerator in the current host ... Whether we actually want to support this not clear, since this only happens when your CPU doesn’t have full KVM support. Some Nix builders are lying about kvm support though. Things aren’t too slow without it though. Fixes https://github.com/NixOS/nixpkgs/issues/85394 Alternative to https://github.com/NixOS/nixpkgs/pull/83920
* | Merge pull request #51850 from roberth/nixos-pureSilvan Mosberger2020-08-241-2/+2
|\ \ | | | | | | nixos/lib/eval-config.nix: Add extraModules parameter for opt-in purity
| * | nixos/lib/eval-config.nix: Add extraModules parameter for opt-in purityRobert Hensing2018-12-101-2/+2
| | |
* | | nixos/testing: Fix fail() functionJanne Heß2020-08-211-2/+5
| |/ |/| | | | | | | The docs say this behaves as succeed(), but it does not return stdout as succeed() does. This fixes that behaviour
* | Merge pull request #93824 from blitz/fix-rpi4-installerJacek Galowicz2020-08-081-1/+4
|\ \ | | | | | | Fix Raspberry Pi 4B SD-Card Install Image
| * | nixos/lib/make-ext4-fs: fix after mkfs.ext4 refactoringJulian Stecklina2020-07-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 9ac1ab10c963a86457c2c9b1edf31542ff3737cd this library function was refactored to use mkfs.ext4 instead of cptofs. There are two problems: If populateImageCommands would create no files (which is fine), a cp invocation would fail due to missing source arguments. Another problem is that mkfs.ext4 relies on fakeroot to have sane uid/gids in the generated filesystem image. This currently doesn't work for cross compiling.
* | | Merge pull request #94611 from Ma27/rel-pkgs-error-msgMaximilian Bosch2020-08-031-3/+3
|\ \ \ | | | | | | | | nixos/manual: improve error message for invalid values in `relatedPackages'
| * | | nixos/manual: improve error message for invalid values in `relatedPackages'Maximilian Bosch2020-08-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported in NixOS discourse[1], tracking down invalid values in `relatedPackages'[2] (i.e. list-items that don't exist in `pkgs`) is fairly hard as the message "Invalid package attribute path `foobar'" is quite unhelpful and the trace doesn't point to the source of the problem either. This patch improves the error message by mentioning that the issue is an invalid `relatedPackages`-declaration in $optionName. [1] https://discourse.nixos.org/t/invalid-package-attribute-path-nextcloud19/8403/9 [2] https://nixos.org/nixpkgs/manual/#sec-functions-library-options
* | | | nixos/lib/*: editorconfig fixeszowoq2020-08-041-4/+4
|/ / /
* | | nixos/lib/make-disk-image.nix: abritary format inputEmery Hemingway2020-07-311-1/+1
| | | | | | | | | | | | | | | Pass unrecognized format types as the output file extension to qemu-img. The motivation is support for "vdi" output.
* | | nixos/boot: some documentation improvementsKeshav Kini2020-07-291-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | - Give a more accurate description of how fileSystems.<name/>.neededForBoot works - Give a more detailed description of how fileSystems.<name/>.encrypted.keyFile works
* | | Merge pull request #89331 from Lassulus/make-disk-imageLassulus2020-07-281-23/+56
|\ \ \ | |/ / |/| | make-disk-image: add hybrid and dynamic sized images
| * | make-disk-image: add hybrid and dynamic sized imageslassulus2020-07-271-23/+56
| | |
* | | Merge pull request #74174 from raboof/fix-74047-stable-gpt-disk-guidTimo Kaufmann2020-07-212-11/+7
|\ \ \ | | | | | | | | make-iso9660-image: produce stable GPT disk GUID
| * | | make-iso9660-image: produce stable GPT disk GUIDArnout Engelen2020-07-202-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By generating a version-5 GUID based on $out (which contains the derivation hash) and preventing isohybrid from overwriting the GPT table (which already is populated correctly by xorriso). Tested by: * booting from USB disk on a UEFI system * booting from USB disk on a non-UEFI system * booting from CD on a UEFI system * booting from CD on a non-UEFI system * booting from CD on an OSX system Also tested that "nix-build ./nixos/release-combined.nix -A nixos.iso_minimal.x86_64-linux -I nixpkgs=~/nixpkgs-r13y --check" now succeeds. Fixes #74047
* | | | lib: toHex -> toHexString & toBase -> toBaseDigitsBas van Dijk2020-07-201-1/+1
| | | | | | | | | | | | | | | | This makes the type of these functions more apparent from the name.
* | | | nixos/tests/networking.nix: test the services.dhcpd4.machines optionBas van Dijk2020-07-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies the `router` to not give out a range of IP addresses but only give out a fixed address based on the MAC address using the `services.dhcpd4.machines` option. To get access to the MAC address the `qemuNicMac` function is defined and exported from `qemu-flags.nix`.
* | | | nixos/tests: support up to 255 nodes in NixOS testsBas van Dijk2020-07-201-1/+5
| |/ / |/| |
* | | nixos make-disk-image: fix permissions of /buildlassulus2020-07-101-0/+1
| | | | | | | | | | | | | | | | | | This was broken in 460c0d6 (PR #90431); now the nixos-unstable channel should get unblocked. vcunat modified this commit to use env-var instead of hardcoding /build