[misc] add helper to import contract

This commit is contained in:
ibizaman 2024-11-23 22:11:40 +01:00
parent 90f625fca0
commit 22b0bfae75
2 changed files with 13 additions and 9 deletions

View file

@ -35,6 +35,14 @@ let
};
};
};
importContract = module:
let
importedModule = pkgs.callPackage module {};
in
mkContractFunctions {
inherit (importedModule) mkRequest mkResult;
};
in
{
inherit mkContractFunctions;
@ -42,7 +50,7 @@ in
databasebackup = import ./databasebackup.nix { inherit lib; };
backup = import ./backup.nix { inherit lib; };
mount = import ./mount.nix { inherit lib; };
secret = import ./secret.nix { inherit pkgs lib; };
secret = importContract ./secret.nix;
ssl = import ./ssl.nix { inherit lib; };
test = {
secret = import ./secret/test.nix { inherit pkgs lib; };

View file

@ -1,10 +1,9 @@
{ pkgs, lib, ... }:
{ lib, ... }:
let
inherit (lib) concatStringsSep literalMD mkOption optionalAttrs optionalString;
inherit (lib.types) anything listOf submodule str;
contractsLib = import ./default.nix { inherit pkgs lib; };
inherit (lib.types) listOf submodule str;
in
{
mkRequest =
{ mode ? "0400",
owner ? "root",
@ -109,7 +108,4 @@ let
path = pathText;
};
});
in
contractsLib.mkContractFunctions {
inherit mkRequest mkResult;
}