blob: 5fe030686bc309f2b1fd1bf6d11595aa491048eb (
plain)
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
|
{ sources ? import ./npins
, pkgs ? import sources.nixpkgs {}
}:
with (import ./lib {});
eval {
machines.bob = { self, config, ... }: {
imports = [
./consumers/users.nix
./contracts/secrets.nix
./providers/asecret.nix
];
networking.hostName = "bob";
asecret.secrets.provider = config.userPasswords.secrets;
userPasswords.secrets.consumer = config.asecret.secrets;
};
machines.alice = {
networking.hostName = "alice";
};
} //
(let
lib = pkgs.lib;
config = {};
in
{
test =
let
inherit ((import ./contracts/secrets.nix {
inherit lib;
}).contracts.secrets) behaviorTest;
in
pkgs.testers.runNixOSTest ({
name = "contracts-filebackup-restic";
meta.maintainers = [ lib.maintainers.ibizaman ];
# I tried using the following line but it leads to infinite recursion.
# Instead, I made a hacky import. pkgs.callPackage was also giving an
# infinite recursion.
#
# } // config.contracts.secret.behaviorTest {
#
} // behaviorTest {
providerRoot = [ "testing" "asecret" "mysecret" "secret" ];
extraModules = [
./providers/asecret.nix
({ config, ... }: {
testing.asecret.mysecret.content = config.test.content;
})
];
});
})
|