forked from fediversity/fediversity
70 lines
1.9 KiB
Nix
70 lines
1.9 KiB
Nix
{
|
|
config,
|
|
system,
|
|
modulesPath,
|
|
inputs,
|
|
sources ? import ../../../npins,
|
|
...
|
|
}:
|
|
let
|
|
inherit (sources) nixpkgs;
|
|
pkgs = import nixpkgs { inherit system; };
|
|
inherit (pkgs) lib;
|
|
inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
|
|
inherit (config)
|
|
nodeName
|
|
pathFromRoot
|
|
pathToRoot
|
|
;
|
|
in
|
|
(pkgs.callPackage ../../utils.nix { inherit inputs; }).evalModel (
|
|
{ config, modulesPath, ... }:
|
|
{
|
|
imports = [ ../common/model.nix ];
|
|
config = {
|
|
environments.default = environment: {
|
|
resources."operator-environment".login-shell.username = "operator";
|
|
implementation =
|
|
{
|
|
required-resources,
|
|
...
|
|
}:
|
|
{
|
|
nixops4 =
|
|
{ providers, ... }:
|
|
{
|
|
providers = {
|
|
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
|
};
|
|
resources.${nodeName} = {
|
|
type = providers.local.exec;
|
|
imports = [
|
|
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
|
../common/targetResource.nix
|
|
];
|
|
nixos.module = {
|
|
imports = [
|
|
(mkNixosConfiguration environment required-resources)
|
|
"${modulesPath}/../lib/testing/nixos-test-base.nix"
|
|
];
|
|
};
|
|
_module.args = { inherit inputs sources; };
|
|
inherit nodeName pathToRoot pathFromRoot;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
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";
|
|
};
|
|
};
|
|
}
|
|
)
|