Fediversity/deployment/check/data-model-tf/data-model.nix

61 lines
1.5 KiB
Nix

{
config,
system,
sources ? import ../../../npins,
...
}@args:
let
inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib;
inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration;
inherit (config)
nodeName
pathToRoot
targetSystem
sshOpts
httpBackend
;
in
(pkgs.callPackage ../../utils.nix { }).evalModel (
{ config, ... }:
{
imports = [ ../common/model.nix ];
config = {
environments.default = environment: {
resources."operator-environment".login-shell.username = "operator";
implementation =
{
required-resources,
deployment-name,
}:
{
tf-host = {
nixos-configuration = mkNixosConfiguration environment required-resources;
system = targetSystem;
ssh = {
username = "root";
host = nodeName;
key-file = null;
inherit sshOpts;
};
caller = "deployment/check/data-model-tf/data-model.nix";
inherit args deployment-name httpBackend;
root-path = pathToRoot;
};
};
};
};
options.default =
let
env = config.environments.default;
in
lib.mkOption {
type = env.resource-mapping.output-type;
default = env.deployment {
deployment-name = "default";
configuration = config."example-configuration";
};
};
}
)