forked from fediversity/fediversity
Compare commits
No commits in common. "4bfb6d3fb275848997bf9b48b5008adc8269f508" and "3a3a0837936eb4b34c3ed6482b4ba900625ac02e" have entirely different histories.
4bfb6d3fb2
...
3a3a083793
9 changed files with 5 additions and 123 deletions
|
|
@ -15,12 +15,6 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: nix-build -A tests
|
- run: nix-build -A tests
|
||||||
|
|
||||||
check-data-model:
|
|
||||||
runs-on: native
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: nix-shell --run 'nix-unit ./deployment/data-model-test.nix'
|
|
||||||
|
|
||||||
check-peertube:
|
check-peertube:
|
||||||
runs-on: native
|
runs-on: native
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1,8 +1,3 @@
|
||||||
.terraform/
|
|
||||||
.terraform.lock.hcl
|
|
||||||
.terraform.tfstate.lock.info
|
|
||||||
terraform.tfstate*
|
|
||||||
.auto.tfvars.json
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
*.log
|
*.log
|
||||||
|
|
|
||||||
|
|
@ -154,3 +154,6 @@ details as to what they are for. As an overview:
|
||||||
|
|
||||||
- [`services/`](./services) contains our effort to make Fediverse applications
|
- [`services/`](./services) contains our effort to make Fediverse applications
|
||||||
work seemlessly together in our specific setting.
|
work seemlessly together in our specific setting.
|
||||||
|
|
||||||
|
- [`website/`](./website) contains the framework and the content of [the
|
||||||
|
Fediversity website](https://fediversity.eu/)
|
||||||
|
|
|
||||||
17
default.nix
17
default.nix
|
|
@ -41,23 +41,6 @@ in
|
||||||
shell = pkgs.mkShellNoCC {
|
shell = pkgs.mkShellNoCC {
|
||||||
inherit (pre-commit-check) shellHook;
|
inherit (pre-commit-check) shellHook;
|
||||||
buildInputs = pre-commit-check.enabledPackages;
|
buildInputs = pre-commit-check.enabledPackages;
|
||||||
packages =
|
|
||||||
let
|
|
||||||
test-loop = pkgs.writeShellApplication {
|
|
||||||
name = "test-loop";
|
|
||||||
runtimeInputs = [
|
|
||||||
pkgs.watchexec
|
|
||||||
pkgs.nix-unit
|
|
||||||
];
|
|
||||||
text = ''
|
|
||||||
watchexec -w ${builtins.toString ./.} -- nix-unit ${builtins.toString ./deployment/data-model-test.nix} "$@"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in
|
|
||||||
[
|
|
||||||
pkgs.nix-unit
|
|
||||||
test-loop
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,6 @@
|
||||||
This directory contains work to generate a full Fediversity deployment from a minimal configuration.
|
This directory contains work to generate a full Fediversity deployment from a minimal configuration.
|
||||||
This is different from [`../services/`](../services) that focuses on one machine, providing a polished and unified interface to different Fediverse services.
|
This is different from [`../services/`](../services) that focuses on one machine, providing a polished and unified interface to different Fediverse services.
|
||||||
|
|
||||||
## Data model
|
|
||||||
|
|
||||||
The core piece of the project is the [Fediversity data model](./data-model.nix), which describes all entities and their interactions.
|
|
||||||
|
|
||||||
What can be done with it is exemplified in the [evaluation tests](./data-model-test.nix).
|
|
||||||
Run `test-loop` in the development environment when hacking on the data model or adding tests.
|
|
||||||
|
|
||||||
## Checks
|
## Checks
|
||||||
|
|
||||||
There are three levels of deployment checks: `basic`, `cli`, `panel`.
|
There are three levels of deployment checks: `basic`, `cli`, `panel`.
|
||||||
|
|
|
||||||
1
deployment/check/cli/deployer.pub
Normal file
1
deployment/check/cli/deployer.pub
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
## This is a placeholder file. It will be overwritten by the test.
|
||||||
|
|
@ -119,6 +119,7 @@ in
|
||||||
with subtest("Configure the deployer key"):
|
with subtest("Configure the deployer key"):
|
||||||
deployer.succeed("""mkdir -p ~/.ssh && ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa""")
|
deployer.succeed("""mkdir -p ~/.ssh && ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa""")
|
||||||
deployer_key = deployer.succeed("cat ~/.ssh/id_rsa.pub").strip()
|
deployer_key = deployer.succeed("cat ~/.ssh/id_rsa.pub").strip()
|
||||||
|
deployer.succeed(f"echo '{deployer_key}' > ${config.pathFromRoot}/deployer.pub")
|
||||||
${forConcat config.targetMachines (tm: ''
|
${forConcat config.targetMachines (tm: ''
|
||||||
${tm}.succeed(f"mkdir -p /root/.ssh && echo '{deployer_key}' >> /root/.ssh/authorized_keys")
|
${tm}.succeed(f"mkdir -p /root/.ssh && echo '{deployer_key}' >> /root/.ssh/authorized_keys")
|
||||||
'')}
|
'')}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
let
|
|
||||||
inherit (import ../default.nix { }) pkgs;
|
|
||||||
inherit (pkgs) lib;
|
|
||||||
eval =
|
|
||||||
module:
|
|
||||||
(lib.evalModules {
|
|
||||||
modules = [
|
|
||||||
module
|
|
||||||
./data-model.nix
|
|
||||||
];
|
|
||||||
}).config;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
test-eval = {
|
|
||||||
expr =
|
|
||||||
let
|
|
||||||
example = eval {
|
|
||||||
runtime-environments.bar.nixos = {
|
|
||||||
module =
|
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
applications.foo = {
|
|
||||||
module =
|
|
||||||
{ pkgs, ... }:
|
|
||||||
{
|
|
||||||
environment.systemPackages = [
|
|
||||||
pkgs.hello
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
has-runtime = lib.isAttrs example.runtime-environments.bar.nixos.module;
|
|
||||||
has-application = lib.isAttrs example.applications.foo.module;
|
|
||||||
};
|
|
||||||
expected = {
|
|
||||||
has-runtime = true;
|
|
||||||
has-application = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (lib) types mkOption;
|
|
||||||
in
|
|
||||||
with types;
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
runtime-environments = mkOption {
|
|
||||||
description = "Collection of runtime environments into which applications can be deployed";
|
|
||||||
type = attrsOf (attrTag {
|
|
||||||
nixos = mkOption {
|
|
||||||
description = "A single NixOS machine";
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
module = mkOption {
|
|
||||||
description = "The NixOS module describing the base configuration for that machine";
|
|
||||||
type = deferredModule;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
applications = mkOption {
|
|
||||||
description = "Collection of Fediversity applications";
|
|
||||||
type = attrsOf (submoduleWith {
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
module = mkOption {
|
|
||||||
description = "The NixOS module for that application, for configuring that application";
|
|
||||||
type = deferredModule;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue