forgejo added as podman container
This commit is contained in:
parent
90bd3afa1b
commit
02e5ddb00f
@ -8,6 +8,7 @@
|
|||||||
desktop = true;
|
desktop = true;
|
||||||
nextcloud.server.enable = true;
|
nextcloud.server.enable = true;
|
||||||
gitlab = true;
|
gitlab = true;
|
||||||
|
forgejo = true;
|
||||||
};
|
};
|
||||||
disk.device.name = "vda";
|
disk.device.name = "vda";
|
||||||
hardware.virtualmachine.type = "kvm";
|
hardware.virtualmachine.type = "kvm";
|
||||||
|
@ -128,6 +128,11 @@
|
|||||||
default = false;
|
default = false;
|
||||||
description = "beancloud.software.gitlab to activate a Gitlab instance running in a nspawn container";
|
description = "beancloud.software.gitlab to activate a Gitlab instance running in a nspawn container";
|
||||||
};
|
};
|
||||||
|
beancloud.software.forgejo = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "beancloud.software.forgejo to activate a Forgejo instance running in a podman container";
|
||||||
|
};
|
||||||
beancloud.software.epson-scan = lib.mkOption {
|
beancloud.software.epson-scan = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
enable = lib.mkIf config.beancloud.software.container true;
|
enable = lib.mkIf config.beancloud.software.container true;
|
||||||
dockerCompat = true;
|
dockerCompat = true;
|
||||||
defaultNetwork.settings.dns_enabled = true;
|
defaultNetwork.settings.dns_enabled = true;
|
||||||
|
autoPrune.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
./firmware.nix
|
./firmware.nix
|
||||||
./gnome.nix
|
./gnome.nix
|
||||||
./gitlab.nix
|
./gitlab.nix
|
||||||
|
./forgejo.nix
|
||||||
./nextcloud.nix
|
./nextcloud.nix
|
||||||
./nix-daemon.nix
|
./nix-daemon.nix
|
||||||
./openssh.nix
|
./openssh.nix
|
||||||
|
96
software/forgejo.nix
Normal file
96
software/forgejo.nix
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf (config.beancloud.software.forgejo) {
|
||||||
|
beancloud.software.container = true;
|
||||||
|
|
||||||
|
environment.etc = {
|
||||||
|
"timezone" = {
|
||||||
|
text = config.time.timeZone;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
forgejo-frontend = {
|
||||||
|
image = "codeberg.org/forgejo/forgejo:11.0.3-rootless";
|
||||||
|
volumes = [
|
||||||
|
"forgejo_data:/data"
|
||||||
|
"/etc/timezone:/etc/timezone:ro"
|
||||||
|
"/etc/localtime:/etc/localtime:ro"
|
||||||
|
];
|
||||||
|
hostname = "forgejo";
|
||||||
|
networks = [
|
||||||
|
"forgejo"
|
||||||
|
];
|
||||||
|
ports = [
|
||||||
|
"127.0.0.1:3000:3000"
|
||||||
|
"127.0.0.1:2222:2222"
|
||||||
|
];
|
||||||
|
autoStart = true;
|
||||||
|
environment = {
|
||||||
|
FORGEJO__database__DB_TYPE = "mysql";
|
||||||
|
FORGEJO__database__HOST = "db:3306";
|
||||||
|
FORGEJO__database__NAME = "forgejo";
|
||||||
|
FORGEJO__database__USER = "forgejo";
|
||||||
|
FORGEJO__database__PASSWD = "forgejo";
|
||||||
|
};
|
||||||
|
dependsOn = [ "forgejo-backend" ];
|
||||||
|
};
|
||||||
|
forgejo-backend = {
|
||||||
|
image = "docker.io/library/mariadb:11.8.2";
|
||||||
|
volumes = [
|
||||||
|
"forgejo_db:/var/lib/mysql"
|
||||||
|
"/etc/timezone:/etc/timezone:ro"
|
||||||
|
"/etc/localtime:/etc/localtime:ro"
|
||||||
|
];
|
||||||
|
hostname = "db";
|
||||||
|
networks = [
|
||||||
|
"forgejo"
|
||||||
|
];
|
||||||
|
autoStart = true;
|
||||||
|
environment = {
|
||||||
|
MYSQL_ROOT_PASSWORD = "forgejo";
|
||||||
|
MYSQL_USER = "forgejo";
|
||||||
|
MYSQL_PASSWORD = "forgejo";
|
||||||
|
MYSQL_DATABASE = "forgejo";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."podman-forgejo-network" = {
|
||||||
|
path = [ pkgs.podman ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStop = "${pkgs.podman}/bin/podman network rm -f forgejo";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
podman network inspect forgejo || podman network create forgejo
|
||||||
|
'';
|
||||||
|
partOf = [ "podman-forgejo-root.target" ];
|
||||||
|
wantedBy = [ "podman-forgejo-root.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."podman-forgejo-frontend" = {
|
||||||
|
partOf = [ "podman-forgejo-root.target" ];
|
||||||
|
wantedBy = [ "podman-forgejo-root.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."podman-forgejo-backend" = {
|
||||||
|
partOf = [ "podman-forgejo-root.target" ];
|
||||||
|
wantedBy = [ "podman-forgejo-root.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.targets."podman-forgejo-root" = {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "root target: When started, this will automatically create all resources and start the containers. When stopped, this will teardown all resources.";
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -117,6 +117,10 @@
|
|||||||
name = "Gitlab";
|
name = "Gitlab";
|
||||||
url = "http://192.168.100.11";
|
url = "http://192.168.100.11";
|
||||||
})
|
})
|
||||||
|
(lib.mkIf osConfig.beancloud.software.forgejo {
|
||||||
|
name = "Forgejo";
|
||||||
|
url = "http://localhost:3000";
|
||||||
|
})
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user