summaryrefslogtreecommitdiffstats
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix41
1 files changed, 39 insertions, 2 deletions
diff --git a/default.nix b/default.nix
index 744d2f0..5fe0306 100644
--- a/default.nix
+++ b/default.nix
@@ -3,10 +3,47 @@
}:
with (import ./lib {});
eval {
- machines.bob = { self, ... }: {
+ 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;
+ })
+ ];
+ });
+})