Compare commits
11 Commits
b78e6456e5
...
mob/gitea
Author | SHA1 | Date | |
---|---|---|---|
70328180fd | |||
4d002d974f | |||
584a7b68c3 | |||
ed41e524e6 | |||
5d0e15b024 | |||
4c327a1bbc | |||
ae240103e1 | |||
5cf4529a97 | |||
d2ca63b445 | |||
1a3a532a9d | |||
09632425c6 |
@@ -90,6 +90,13 @@
|
|||||||
};
|
};
|
||||||
roles.default.machines.b4l = { };
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
|
gitea = {
|
||||||
|
module = {
|
||||||
|
name = "gitea";
|
||||||
|
input = "self";
|
||||||
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
2
machines/b4l/services/gitea.nix
Normal file
2
machines/b4l/services/gitea.nix
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
27
modules/clan/gitea/default.nix
Normal file
27
modules/clan/gitea/default.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
_class = "clan.service";
|
||||||
|
manifest.name = "gitea";
|
||||||
|
manifest.description = "Git with a cup of tea!";
|
||||||
|
manifest.categories = [ "System" ];
|
||||||
|
|
||||||
|
roles.default = {
|
||||||
|
|
||||||
|
perInstance.nixosModule =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
services.gitea = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
dump = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
clan.core.state.gitea.folders = [ config.services.gitea.dump.backupDir ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
18
modules/clan/gitea/flake-module.nix
Normal file
18
modules/clan/gitea/flake-module.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
module = lib.modules.importApply ./default.nix { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
clan.modules = {
|
||||||
|
gitea = module;
|
||||||
|
};
|
||||||
|
perSystem =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
clan.nixosTests.gitea = {
|
||||||
|
imports = [ ./tests/vm/default.nix ];
|
||||||
|
|
||||||
|
clan.modules."@clan/gitea" = module;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
50
modules/clan/gitea/tests/vm/default.nix
Normal file
50
modules/clan/gitea/tests/vm/default.nix
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
name = "service-gitea";
|
||||||
|
|
||||||
|
clan = {
|
||||||
|
directory = ./.;
|
||||||
|
inventory = {
|
||||||
|
machines.server = { };
|
||||||
|
|
||||||
|
instances = {
|
||||||
|
gitea-test = {
|
||||||
|
module.name = "@clan/gitea";
|
||||||
|
module.input = "self";
|
||||||
|
roles.default.machines."server".settings = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
server = {
|
||||||
|
services.gitea = {
|
||||||
|
dump.file = "test-dump";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
{ nodes, ... }:
|
||||||
|
let
|
||||||
|
gitea = nodes.server.config.services.gitea;
|
||||||
|
in
|
||||||
|
''
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
server.wait_for_unit("gitea")
|
||||||
|
|
||||||
|
server.succeed("systemctl status gitea")
|
||||||
|
server.wait_for_open_port(3000)
|
||||||
|
server.succeed("curl http://127.0.0.1:3000")
|
||||||
|
|
||||||
|
server.succeed("${lib.getExe pkgs.gitea} dump -h")
|
||||||
|
server.succeed("systemctl start gitea-dump")
|
||||||
|
server.wait_for_file("${gitea.dump.backupDir}/${gitea.dump.file}")
|
||||||
|
'';
|
||||||
|
}
|
Reference in New Issue
Block a user