···275276In that case, `numpy` is chosen from the generic `python3Packages`.
27700000000000000000000000000000000000000000000000000000000278## Test Options Reference {#sec-test-options-reference}
279280The following options can be used when writing tests.
···275276In that case, `numpy` is chosen from the generic `python3Packages`.
277278+## Overriding a test {#sec-override-nixos-test}
279+280+The NixOS test framework returns tests with multiple overriding methods.
281+282+`overrideTestDerivation` *function*
283+: Like applying `overrideAttrs` on the [test](#test-opt-test) derivation.
284+285+ This is a convenience for `extend` with an override on the [`rawTestDerivationArg`](#test-opt-rawTestDerivationArg) option.
286+287+ *function*
288+ : An extension function, e.g. `finalAttrs: prevAttrs: { /* … */ }`, the result of which is passed to [`mkDerivation`](https://nixos.org/manual/nixpkgs/stable/#sec-using-stdenv).
289+ Just as with `overrideAttrs`, an abbreviated form can be used, e.g. `prevAttrs: { /* … */ }` or even `{ /* … */ }`.
290+ See [`lib.extends`](https://nixos.org/manual/nixpkgs/stable/#function-library-lib.fixedPoints.extends).
291+292+`extendNixOS { module = ` *module* `; specialArgs = ` *specialArgs* `; }`
293+: Evaluates the test with additional NixOS modules and/or arguments.
294+295+ `module`
296+ : A NixOS module to add to all the nodes in the test. Sets test option [`extraBaseModules`](#test-opt-extraBaseModules).
297+298+ `specialArgs`
299+ : An attribute set of arguments to pass to all NixOS modules. These override the existing arguments, as well as any `_module.args.<name>` that the modules may define. Sets test option [`node.specialArgs`](#test-opt-node.specialArgs).
300+301+ This is a convenience function for `extend` that overrides the aforementioned test options.
302+303+ :::{.example #ex-nixos-test-extendNixOS}
304+305+ # Using extendNixOS in `passthru.tests` to make `(openssh.tests.overrideAttrs f).tests.nixos` coherent
306+307+ ```nix
308+ mkDerivation (finalAttrs: {
309+ # …
310+ passthru = {
311+ tests = {
312+ nixos = nixosTests.openssh.extendNixOS {
313+ module = {
314+ services.openssh.package = finalAttrs.finalPackage;
315+ };
316+ };
317+ };
318+ };
319+ })
320+ ```
321+ :::
322+323+`extend { modules = ` *modules* `; specialArgs = ` *specialArgs* `; }`
324+: Adds new `nixosTest` modules and/or module arguments to the test, which are evaluated together with the existing modules and [built-in options](#sec-test-options-reference).
325+326+ If you're only looking to extend the _NixOS_ configurations of the test, and not something else about the test, you may use the `extendNixOS` convenience function instead.
327+328+ `modules`
329+ : A list of modules to add to the test. These are added to the existing modules and then [evaluated](https://nixos.org/manual/nixpkgs/stable/index.html#module-system-lib-evalModules) together.
330+331+ `specialArgs`
332+ : An attribute of arguments to pass to the test. These override the existing arguments, as well as any `_module.args.<name>` that the modules may define. See [`evalModules`/`specialArgs`](https://nixos.org/manual/nixpkgs/stable/#module-system-lib-evalModules-param-specialArgs).
333+334## Test Options Reference {#sec-test-options-reference}
335336The following options can be used when writing tests.
···112113- `services.ntpd-rs` now performs configuration validation.
11400115- `amdgpu` kernel driver overdrive mode can now be enabled by setting [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable) and customized through [hardware.amdgpu.overdrive.ppfeaturemask](#opt-hardware.amdgpu.overdrive.ppfeaturemask).
116 This allows for fine-grained control over the GPU's performance and maybe required by overclocking softwares like Corectrl and Lact. These new options replace old options such as {option}`programs.corectrl.gpuOverclock.enable` and {option}`programs.tuxclocker.enableAMD`.
117
···112113- `services.ntpd-rs` now performs configuration validation.
114115+- `services.monero` now includes the `environmentFile` option for adding secrets to the Monero daemon config.
116+117- `amdgpu` kernel driver overdrive mode can now be enabled by setting [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable) and customized through [hardware.amdgpu.overdrive.ppfeaturemask](#opt-hardware.amdgpu.overdrive.ppfeaturemask).
118 This allows for fine-grained control over the GPU's performance and maybe required by overclocking softwares like Corectrl and Lact. These new options replace old options such as {option}`programs.corectrl.gpuOverclock.enable` and {option}`programs.tuxclocker.enableAMD`.
119
···226 '';
227 };
228229+ environmentFile = lib.mkOption {
230+ type = lib.types.nullOr lib.types.path;
231+ default = null;
232+ example = "/var/lib/monero/monerod.env";
233+ description = ''
234+ Path to an EnvironmentFile for the monero service as defined in {manpage}`systemd.exec(5)`.
235+236+ Secrets may be passed to the service by specifying placeholder variables in the Nix config
237+ and setting values in the environment file.
238+239+ Example:
240+241+ ```
242+ # In environment file:
243+ MINING_ADDRESS=888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H
244+ ```
245+246+ ```
247+ # Service config
248+ services.monero.mining.address = "$MINING_ADDRESS";
249+ ```
250+ '';
251+ };
252+253 extraConfig = lib.mkOption {
254 type = lib.types.lines;
255 default = "";
···281 after = [ "network.target" ];
282 wantedBy = [ "multi-user.target" ];
283284+ preStart = ''
285+ umask 077
286+ ${pkgs.envsubst}/bin/envsubst \
287+ -i ${configFile} \
288+ -o ${cfg.dataDir}/monerod.conf
289+ '';
290+291 serviceConfig = {
292 User = "monero";
293 Group = "monero";
294+ EnvironmentFile = lib.mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
295+ ExecStart = "${lib.getExe' pkgs.monero-cli "monerod"} --config-file=${cfg.dataDir}/monerod.conf --non-interactive";
296 Restart = "always";
297 SuccessExitStatus = [
298 0
+38-5
nixos/tests/kubo/kubo-fuse.nix
···27 testScript = ''
28 start_all()
2930- with subtest("FUSE mountpoint"):
31- machine.fail("echo a | su bob -l -c 'ipfs add --quieter'")
000032 # The FUSE mount functionality is broken as of v0.13.0. This is still the case with v0.29.0.
33 # See https://github.com/ipfs/kubo/issues/9044.
34 # Workaround: using CID Version 1 avoids that.
···36 "echo fnord3 | su alice -l -c 'ipfs add --quieter --cid-version=1'"
37 ).strip()
3839- machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
0000000000000000000000000004041- with subtest("Unmounting of /ipns and /ipfs"):
042 # Force Kubo to crash and wait for it to restart
43 machine.systemctl("kill --signal=SIGKILL ipfs.service")
44 machine.wait_for_unit("ipfs.service", timeout = 30)
4546- machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
047 '';
48}
···27 testScript = ''
28 start_all()
2930+ with subtest("Create a file for testing"):
31+ machine.succeed("echo 'fnord3' > /tmp/test.txt")
32+33+34+ with subtest("/ipfs/ FUSE mountpoint"):
35+ machine.fail("su bob -l -c 'ipfs add --quieter' < /tmp/test.txt")
36 # The FUSE mount functionality is broken as of v0.13.0. This is still the case with v0.29.0.
37 # See https://github.com/ipfs/kubo/issues/9044.
38 # Workaround: using CID Version 1 avoids that.
···40 "echo fnord3 | su alice -l -c 'ipfs add --quieter --cid-version=1'"
41 ).strip()
4243+ machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
44+45+46+ with subtest("/mfs/ FUSE mountpoint"):
47+ with subtest("Write the test file in three different ways"):
48+ machine.succeed("cp /tmp/test.txt /mfs/test-1.txt")
49+ machine.succeed("su alice -c 'ipfs files write --create /test-2.txt < /tmp/test.txt'")
50+ machine.succeed(f"ipfs files cp /ipfs/{ipfs_hash} /test-3.txt")
51+52+ with subtest("Show the files (for debugging)"):
53+ # Different hashes for the different ways of adding the file to the MFS probably come from different linking structures of the merkle tree. Copying the file to /mfs with `cp` is even non-deterministic.
54+ machine.succeed("ipfs files ls --long >&2")
55+ machine.succeed("ls -l /mfs >&2")
56+57+ with subtest("Check that everyone has permission to read the file (because of Mounts.FuseAllowOther)"):
58+ machine.succeed("su alice -c 'cat /mfs/test-1.txt' | grep fnord3")
59+ machine.succeed("su bob -c 'cat /mfs/test-1.txt' | grep fnord3")
60+61+ with subtest("Check the file contents"):
62+ machine.succeed("diff /tmp/test.txt /mfs/test-1.txt")
63+ machine.succeed("diff /tmp/test.txt /mfs/test-2.txt")
64+ machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
65+66+ with subtest("Check the CID extended attribute"):
67+ output = machine.succeed(
68+ "getfattr --only-values --name=ipfs_cid /mfs/test-3.txt"
69+ ).strip()
70+ assert ipfs_hash == output, f"Expected {ipfs_hash} but got {output}"
7172+73+ with subtest("Unmounting of /ipns, /ipfs and /mfs"):
74 # Force Kubo to crash and wait for it to restart
75 machine.systemctl("kill --signal=SIGKILL ipfs.service")
76 machine.wait_for_unit("ipfs.service", timeout = 30)
7778+ machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
79+ machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
80 '';
81}
+39-18
pkgs/build-support/testers/test/default.nix
···30 __structuredAttrs = enable;
31 });
32 });
0000000000000000003334in
35lib.recurseIntoAttrs {
···66 };
67 };
6869- runNixOSTest-example = pkgs-with-overlay.testers.runNixOSTest (
70- { lib, ... }:
71- {
72- name = "runNixOSTest-test";
73- nodes.machine =
74- { pkgs, ... }:
75- {
76- system.nixos = dummyVersioning;
77- environment.systemPackages = [
78- pkgs.proof-of-overlay-hello
79- pkgs.figlet
80- ];
81- };
82- testScript = ''
83- machine.succeed("hello | figlet >/dev/console")
84- '';
85- }
86- );
0008788 # Check that the wiring of nixosTest is correct.
89 # Correct operation of the NixOS test driver should be asserted elsewhere.
···89buildGoModule rec {
10 pname = "kubo";
11- version = "0.34.1"; # When updating, also check if the repo version changed and adjust repoVersion below
12 rev = "v${version}";
1314 passthru.repoVersion = "16"; # Also update kubo-migrator when changing the repo version
···16 # Kubo makes changes to its source tarball that don't match the git source.
17 src = fetchurl {
18 url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
19- hash = "sha256-wrAnmPfls7LFO3gQBISSmn4ucuUVmzvYEoz+eVc/A5M=";
20 };
2122 # tarball contains multiple files/directories
···89buildGoModule rec {
10 pname = "kubo";
11+ version = "0.35.0"; # When updating, also check if the repo version changed and adjust repoVersion below
12 rev = "v${version}";
1314 passthru.repoVersion = "16"; # Also update kubo-migrator when changing the repo version
···16 # Kubo makes changes to its source tarball that don't match the git source.
17 src = fetchurl {
18 url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
19+ hash = "sha256-OubXaa2JWbEaakDV6pExm5PkiZ5XPd9uG+S4KwWb0xQ=";
20 };
2122 # tarball contains multiple files/directories
···435 ATH10K_DFS_CERTIFIED = option yes;
436 B43_PHY_HT = option yes;
437 BCMA_HOST_PCI = option yes;
438+439+ # Enable "untested" hardware support for RTL8xxxU.
440+ # There's a bunch of those still floating around,
441+ # and given how old the hardware is, we're unlikely
442+ # to kill any, so let's enable all known device IDs.
443+ RTL8XXXU_UNTESTED = option yes;
444+445 RTW88 = module;
446 RTW88_8822BE = lib.mkMerge [
447 (whenOlder "5.8" yes)