forked from fediversity/fediversity
Compare commits
3 commits
4091d8c6b2
...
c8655de423
| Author | SHA1 | Date | |
|---|---|---|---|
| c8655de423 | |||
| a8e56f0456 | |||
| a7ca58c2d3 |
4 changed files with 57 additions and 50 deletions
|
|
@ -9,10 +9,9 @@ let
|
||||||
git-hooks
|
git-hooks
|
||||||
gitignore
|
gitignore
|
||||||
;
|
;
|
||||||
inherit (import sources.flake-inputs) import-flake;
|
|
||||||
inputs = (import-flake { src = ./.; }).inputs;
|
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
inherit (import sources.flake-inputs) import-flake;
|
inherit (import sources.flake-inputs) import-flake;
|
||||||
|
inputs = (import-flake { src = ./.; }).inputs;
|
||||||
inherit ((import-flake { src = ./.; }).inputs) nixops4;
|
inherit ((import-flake { src = ./.; }).inputs) nixops4;
|
||||||
panel = import ./panel { inherit sources system; };
|
panel = import ./panel { inherit sources system; };
|
||||||
pre-commit-check =
|
pre-commit-check =
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
let
|
let
|
||||||
inherit (import ../default.nix { }) pkgs inputs;
|
inherit (import ../default.nix { }) pkgs inputs;
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
inherit (lib) mkOption;
|
inherit (lib) mkOption types;
|
||||||
eval =
|
eval =
|
||||||
module:
|
module:
|
||||||
(lib.evalModules {
|
(lib.evalModules {
|
||||||
|
|
@ -15,7 +15,7 @@ let
|
||||||
./data-model.nix
|
./data-model.nix
|
||||||
];
|
];
|
||||||
}).config;
|
}).config;
|
||||||
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
|
nixops4Deployment = import ./deployment.nix { inherit lib inputs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
test-eval = {
|
test-eval = {
|
||||||
|
|
@ -131,16 +131,16 @@ in
|
||||||
_class = "fediversity-environment";
|
_class = "fediversity-environment";
|
||||||
resources.shell.login-shell.username = "operator";
|
resources.shell.login-shell.username = "operator";
|
||||||
implementation =
|
implementation =
|
||||||
requests:
|
{ ... }:
|
||||||
{ providers, ... }:
|
# { providers, ... }:
|
||||||
{
|
{
|
||||||
_class = "nixops4Deployment";
|
# _class = "nixops4Deployment";
|
||||||
providers = {
|
# providers = {
|
||||||
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
# inherit (inputs.nixops4.modules.nixops4Provider) local;
|
||||||
};
|
# };
|
||||||
resources.the-machine = {
|
resources.the-machine = {
|
||||||
_class = "nixops4Resource";
|
_class = "nixops4Resource";
|
||||||
type = providers.local.exec;
|
# type = providers.local.exec;
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
||||||
];
|
];
|
||||||
|
|
@ -149,7 +149,8 @@ in
|
||||||
{
|
{
|
||||||
_class = "nixos";
|
_class = "nixos";
|
||||||
users.users = config.resources.shell.login-shell.apply (
|
users.users = config.resources.shell.login-shell.apply (
|
||||||
lib.filterAttrs (_name: value: value ? login-shell) requests
|
# lib.filterAttrs (_name: value: value ? login-shell) requests
|
||||||
|
lib.filterAttrs (_name: value: value ? login-shell) { }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -166,14 +167,14 @@ in
|
||||||
applications.hello.enable = true;
|
applications.hello.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
example-deployment = mkOption {
|
||||||
environments.single-nixos-vm = {
|
type = types.submoduleWith {
|
||||||
|
class = "nixops4Deployment";
|
||||||
};
|
modules = [ nixops4Deployment ];
|
||||||
configurations.example = {
|
};
|
||||||
enable = true;
|
readOnly = true;
|
||||||
applications.hello.enable = true;
|
default = config.environments.single-nixos-vm.deployment config.example-configuration;
|
||||||
# default = config.environments.single-nixos-vm.deployment config.example-configuration;
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ let
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
nixops4Deployment = import ./deployment.nix { inherit lib inputs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
_class = "fediversity-settings";
|
_class = "fediversity-settings";
|
||||||
|
|
@ -107,26 +108,6 @@ in
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
configuration = mkOption {
|
|
||||||
description = "Configuration type declaring options to be set by operators";
|
|
||||||
type = optionType;
|
|
||||||
readOnly = true;
|
|
||||||
default = submodule {
|
|
||||||
options = {
|
|
||||||
enable = lib.mkEnableOption {
|
|
||||||
description = "your Fediversity configuration";
|
|
||||||
};
|
|
||||||
applications = lib.mapAttrs (
|
|
||||||
_name: application:
|
|
||||||
mkOption {
|
|
||||||
description = application.description;
|
|
||||||
type = submodule application.module;
|
|
||||||
default = { };
|
|
||||||
}
|
|
||||||
) config.applications;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
environments = mkOption {
|
environments = mkOption {
|
||||||
description = "Run-time environments for Fediversity applications to be deployed to";
|
description = "Run-time environments for Fediversity applications to be deployed to";
|
||||||
type = attrsOf (submoduleWith {
|
type = attrsOf (submoduleWith {
|
||||||
|
|
@ -157,7 +138,7 @@ in
|
||||||
};
|
};
|
||||||
implementation = mkOption {
|
implementation = mkOption {
|
||||||
description = "Mapping of resources required by applications to available resources; the result can be deployed";
|
description = "Mapping of resources required by applications to available resources; the result can be deployed";
|
||||||
type = environment.config.resource-mapping.function-type;
|
# type = environment.config.resource-mapping.output-type;
|
||||||
};
|
};
|
||||||
resource-mapping = mkOption {
|
resource-mapping = mkOption {
|
||||||
description = "Function type for the mapping from resources to a (NixOps4) deployment";
|
description = "Function type for the mapping from resources to a (NixOps4) deployment";
|
||||||
|
|
@ -178,15 +159,7 @@ in
|
||||||
modules = [ environment.config.resource-mapping.output-type ];
|
modules = [ environment.config.resource-mapping.output-type ];
|
||||||
});
|
});
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default =
|
default = _cfg: environment.config.implementation;
|
||||||
cfg:
|
|
||||||
# TODO: check cfg.enable.true
|
|
||||||
let
|
|
||||||
required-resources = lib.mapAttrs (
|
|
||||||
name: application-settings: config.applications.${name}.resources application-settings
|
|
||||||
) cfg.applications;
|
|
||||||
in
|
|
||||||
(environment.config.implementation required-resources).output;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
34
deployment/deployment.nix
Normal file
34
deployment/deployment.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
# inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# let
|
||||||
|
# nixops4 = inputs.nixops4.outPath;
|
||||||
|
# in
|
||||||
|
|
||||||
|
# inputs.nixops4.modules.nixops4Deployment.default
|
||||||
|
|
||||||
|
# import inputs.nixops4.modules.nixops4Deployment.default
|
||||||
|
|
||||||
|
# resources: import inputs.nixops4.modules.nixops4Deployment.default {
|
||||||
|
# inherit lib config resources;
|
||||||
|
# # config = {
|
||||||
|
# # type providers provider inputs outputsSkeleton resourceType
|
||||||
|
# # };
|
||||||
|
# }
|
||||||
|
|
||||||
|
# {
|
||||||
|
# imports = [
|
||||||
|
# "${nixops4}/nix/deployment/providers.nix"
|
||||||
|
# "${nixops4}/nix/deployment/resources.nix"
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
# "${nixops4}/nix/deployment/resources.nix"
|
||||||
|
|
||||||
|
{
|
||||||
|
options.resources = lib.mkOption {
|
||||||
|
type = lib.types.attrs;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue