generated from goodbyekansas/opensource-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.nix
78 lines (72 loc) · 2.28 KB
/
test.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
nedryland:
let
inherit (nedryland) pkgs;
mockBase = rec {
versionAtLeast = _: true;
mkComponent = attrs: attrs // { isNedrylandComponent = true; };
mkLibrary = mkComponent;
mkClient = mkComponent;
mkService = mkComponent;
mkTargetSetup = mkComponent;
parseConfig = { structure, ... }: structure;
mkDerivation = attrs:
let
inner = attrs: attrs // { isNedrylandDerivation = true; type = "derivation"; };
drv = pkgs.lib.makeOverridable inner attrs;
in
drv // {
overrideAttrs = f: drv // (f drv);
};
resolveInputs = name: typeName: targets: builtins.map
(input:
if input ? isNedrylandComponent then
builtins.getAttr
(pkgs.lib.findFirst
(target: builtins.hasAttr target input)
(abort "${name}.${typeName} has none of the targets ${builtins.toString targets}.")
targets)
input
else
input
);
components = {
servisen = c.mkService { name = "plate"; version = "1.2.1"; src = null; };
};
inherit callFunction callFile;
mapComponentsRecursive = _f: _a: { };
};
# callFile and callFunction will auto-populate dependencies
# on nixpkgs, base members and project components
callFile = path: callFunction (import path) path;
callFunction = function:
let
args = builtins.functionArgs function;
in
_:
pkgs.lib.makeOverridable
(
overrides:
function
(
(builtins.intersectAttrs args pkgs)
// (builtins.intersectAttrs args (mockBase // { base = mockBase; }))
// overrides
)
);
inherit ((mockBase.callFile ./languages.nix { }).languages) python terraform rust c;
systemEmojis = {
"aarch64-linux" = "🦾 🐧";
"aarch64-darwin" = "🦾 🍏";
"x86_64-darwin" = "x🎱🕕 🍏";
"x86_64-linux" = "x🎱🕕 🐧";
};
in
builtins.trace "Running tests for ${pkgs.lib.version} ${pkgs.system} ${systemEmojis.${pkgs.system} or "🖥"}" rec {
tests = {
python = import ./tests/python.nix python pkgs;
terraform = import ./tests/terraform.nix terraform pkgs;
rust = import ./tests/rust.nix rust pkgs;
c = import ./tests/c.nix c pkgs;
};
all = builtins.attrValues tests;
}