forked from Fediversity/Fediversity
factor out data model
This commit is contained in:
parent
b5a96a70b8
commit
80e2a9b909
4 changed files with 18 additions and 14 deletions
|
@ -11,8 +11,8 @@ let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
deployment-config = config;
|
deployment-config = config;
|
||||||
|
inherit (deployment-config) nodeName;
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkOption types;
|
||||||
inherit (import ./constants.nix) targetMachines pathToRoot pathFromRoot;
|
|
||||||
eval =
|
eval =
|
||||||
module:
|
module:
|
||||||
(lib.evalModules {
|
(lib.evalModules {
|
||||||
|
@ -106,7 +106,7 @@ let
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./options.nix
|
./data-model-options.nix
|
||||||
../common/sharedOptions.nix
|
../common/sharedOptions.nix
|
||||||
../common/targetNode.nix
|
../common/targetNode.nix
|
||||||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||||
|
@ -130,7 +130,7 @@ let
|
||||||
nixos-configuration = mkNixosConfiguration environment requests;
|
nixos-configuration = mkNixosConfiguration environment requests;
|
||||||
ssh = {
|
ssh = {
|
||||||
username = "root";
|
username = "root";
|
||||||
inherit (deployment-config) host;
|
host = nodeName;
|
||||||
key-file = null;
|
key-file = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -146,7 +146,7 @@ let
|
||||||
providers = {
|
providers = {
|
||||||
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
||||||
};
|
};
|
||||||
resources = lib.genAttrs targetMachines (nodeName: {
|
resources.${nodeName} = {
|
||||||
type = providers.local.exec;
|
type = providers.local.exec;
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
||||||
|
@ -154,8 +154,8 @@ let
|
||||||
];
|
];
|
||||||
nixos.module = mkNixosConfiguration environment requests;
|
nixos.module = mkNixosConfiguration environment requests;
|
||||||
_module.args = { inherit inputs sources; };
|
_module.args = { inherit inputs sources; };
|
||||||
inherit nodeName pathToRoot pathFromRoot;
|
inherit (deployment-config) nodeName pathToRoot pathFromRoot;
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
|
@ -17,9 +17,12 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
nixops4Deployments.check-deployment-model =
|
nixops4Deployments.check-deployment-model =
|
||||||
(import ./deployment/check/data-model/deployment.nix {
|
(import ./deployment/check/common/data-model.nix {
|
||||||
inherit system inputs;
|
inherit system inputs;
|
||||||
config.host = "nixops4";
|
config = {
|
||||||
|
inherit (import ./deployment/check/data-model/constants.nix) pathToRoot pathFromRoot;
|
||||||
|
nodeName = "nixops4";
|
||||||
|
};
|
||||||
})."nixops4-deployment".nixops4;
|
})."nixops4-deployment".nixops4;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,12 +9,13 @@ let
|
||||||
inherit (import ./constants.nix) pathToRoot;
|
inherit (import ./constants.nix) pathToRoot;
|
||||||
escapedJson = v: lib.replaceStrings [ "\"" ] [ "\\\\\"" ] (lib.strings.toJSON v);
|
escapedJson = v: lib.replaceStrings [ "\"" ] [ "\\\\\"" ] (lib.strings.toJSON v);
|
||||||
deployment-config = {
|
deployment-config = {
|
||||||
|
inherit (import ./constants.nix) pathToRoot pathFromRoot;
|
||||||
inherit (config) enableAcme;
|
inherit (config) enableAcme;
|
||||||
acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null;
|
acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null;
|
||||||
host = "ssh";
|
nodeName = "ssh";
|
||||||
};
|
};
|
||||||
inherit
|
inherit
|
||||||
((import ./deployment.nix {
|
((import ../common/data-model.nix {
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
config = deployment-config;
|
config = deployment-config;
|
||||||
|
@ -28,16 +29,16 @@ in
|
||||||
{
|
{
|
||||||
_class = "nixosTest";
|
_class = "nixosTest";
|
||||||
imports = [
|
imports = [
|
||||||
./options.nix
|
../common/data-model-options.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
name = "deployment-model";
|
name = "deployment-model";
|
||||||
sourceFileset = lib.fileset.unions [
|
sourceFileset = lib.fileset.unions [
|
||||||
../../data-model.nix
|
../../data-model.nix
|
||||||
../../function.nix
|
../../function.nix
|
||||||
|
../common/data-model.nix
|
||||||
|
../common/data-model-options.nix
|
||||||
./constants.nix
|
./constants.nix
|
||||||
./deployment.nix
|
|
||||||
./options.nix
|
|
||||||
(config.pathToCwd + "/flake-under-test.nix")
|
(config.pathToCwd + "/flake-under-test.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ in
|
||||||
import ${pathToRoot}/deployment/nixos.nix {
|
import ${pathToRoot}/deployment/nixos.nix {
|
||||||
inherit system;
|
inherit system;
|
||||||
configuration = (
|
configuration = (
|
||||||
import ${pathToRoot}/deployment/check/data-model/deployment.nix {
|
import ${pathToRoot}/deployment/check/common/data-model.nix {
|
||||||
inherit system;
|
inherit system;
|
||||||
config = builtins.fromJSON "${escapedJson deployment-config}";
|
config = builtins.fromJSON "${escapedJson deployment-config}";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue