mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
72 lines
1.9 KiB
Nix
72 lines
1.9 KiB
Nix
# Miscellaneous small tests that don't warrant their own VM run.
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
inherit (pkgs) lib;
|
|
tests = {
|
|
default = testsForPackage { nixPackage = pkgs.nix; };
|
|
lix = testsForPackage { nixPackage = pkgs.lix; };
|
|
};
|
|
|
|
testsForPackage =
|
|
args:
|
|
lib.recurseIntoAttrs {
|
|
# If the attribute is not named 'test'
|
|
# You will break all the universe on the release-*.nix side of things.
|
|
# `discoverTests` relies on `test` existence to perform a `callTest`.
|
|
test = testMiscFeatures args;
|
|
passthru.override = args': testsForPackage (args // args');
|
|
};
|
|
|
|
testMiscFeatures =
|
|
{ nixPackage, ... }:
|
|
pkgs.testers.nixosTest (
|
|
let
|
|
foo = pkgs.writeText "foo" "Hello World";
|
|
in
|
|
{
|
|
name = "${nixPackage.pname}-misc";
|
|
meta.maintainers = with lib.maintainers; [
|
|
raitobezarius
|
|
artturin
|
|
];
|
|
|
|
nodes.machine =
|
|
{ lib, ... }:
|
|
{
|
|
system.extraDependencies = [ foo ];
|
|
|
|
nix.package = nixPackage;
|
|
};
|
|
|
|
testScript = ''
|
|
import json
|
|
|
|
def get_path_info(path):
|
|
result = machine.succeed(f"nix --option experimental-features nix-command path-info --json {path}")
|
|
parsed = json.loads(result)
|
|
return parsed
|
|
|
|
with subtest("nix-db"):
|
|
out = "${foo}"
|
|
info = get_path_info(out)
|
|
print(info)
|
|
|
|
pathinfo = info[0] if isinstance(info, list) else info[out]
|
|
|
|
if (
|
|
pathinfo["narHash"]
|
|
!= "sha256-BdMdnb/0eWy3EddjE83rdgzWWpQjfWPAj3zDIFMD3Ck="
|
|
):
|
|
raise Exception("narHash not set")
|
|
|
|
if pathinfo["narSize"] != 128:
|
|
raise Exception("narSize not set")
|
|
|
|
with subtest("nix-db"):
|
|
machine.succeed("nix-store -qR /run/current-system | grep nixos-")
|
|
'';
|
|
}
|
|
);
|
|
in
|
|
tests
|