forked from nix-community/nix-index-database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.nix
48 lines (45 loc) · 1.28 KB
/
tests.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
system,
nixpkgs,
nixIndexModule,
}:
{
nixosTest = nixpkgs.lib.nixos.runTest {
name = "nix-index-nixos-test";
imports = [
{
nodes = {
node1 =
{ pkgs, ... }:
{
imports = [
nixIndexModule
{
programs.command-not-found.enable = false;
programs.nix-index-database.comma.enable = true;
# Point comma at our nixpkgs instance.
# Passing --nixpkgs-flake instead seems to fail when nix tries to use the network.
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
# Add ripgrep to the store so that comma can find it
virtualisation.additionalPaths = [ pkgs.ripgrep ];
}
];
};
};
testScript = ''
start_all()
# Check that nix-locate works
node1.succeed(" | ".join([
"nix-locate --top-level --whole-name --at-root '/bin/rg'",
"cut -d' ' -f1",
"grep -F 'ripgrep.out'"
]))
# Check that comma works
node1.fail("rg --help")
node1.succeed(", rg --help")
'';
}
];
hostPkgs = nixpkgs.legacyPackages.${system};
};
}