mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-05-20 05:12:34 +02:00
New way to deploy apps in my server
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
+68
-57
@@ -1,68 +1,79 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
|
||||
domain = config.var.domain;
|
||||
catppuccin-gitea = pkgs.fetchzip {
|
||||
url = "https://github.com/catppuccin/gitea/releases/download/v1.0.2/catppuccin-gitea.tar.gz";
|
||||
sha256 = "sha256-rZHLORwLUfIFcB6K9yhrzr+UwdPNQVSadsw6rg8Q7gs=";
|
||||
stripRoot = false;
|
||||
};
|
||||
in {
|
||||
services = {
|
||||
postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [config.services.gitea.user]; # "gitea" par défaut
|
||||
ensureUsers = [
|
||||
{
|
||||
name = config.services.gitea.database.user;
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
gitea = {
|
||||
enable = true;
|
||||
database = {
|
||||
type = "postgres";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(mkContainer {
|
||||
name = "gitea";
|
||||
hostIp = "10.233.11.1";
|
||||
containerIp = "10.233.11.2";
|
||||
internet = true;
|
||||
bindMounts."/var/lib/gitea" = {
|
||||
hostPath = "/var/lib/gitea";
|
||||
isReadOnly = false;
|
||||
};
|
||||
settings = {
|
||||
server = {
|
||||
HTTP_ADDR = "127.0.0.1";
|
||||
HTTP_PORT = 3002;
|
||||
ROOT_URL = "https://git.${config.var.domain}/";
|
||||
DOMAIN = "git.${config.var.domain}";
|
||||
LANDING_PAGE = "/anotherhadi";
|
||||
nixosConfig = { lib, ... }: {
|
||||
users.users.gitea.uid = lib.mkForce 978;
|
||||
users.groups.gitea.gid = lib.mkForce 968;
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "gitea" ];
|
||||
ensureUsers = [{
|
||||
name = "gitea";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
};
|
||||
service = {
|
||||
REGISTER_MANUAL_CONFIRM = true;
|
||||
DISABLE_REGISTRATION = true;
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = true;
|
||||
SHOW_REGISTRATION_BUTTON = false;
|
||||
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
database.type = "postgres";
|
||||
settings = {
|
||||
server = {
|
||||
HTTP_ADDR = "0.0.0.0";
|
||||
HTTP_PORT = 3002;
|
||||
ROOT_URL = "https://git.${domain}/";
|
||||
DOMAIN = "git.${domain}";
|
||||
LANDING_PAGE = "/anotherhadi";
|
||||
};
|
||||
service = {
|
||||
REGISTER_MANUAL_CONFIRM = true;
|
||||
DISABLE_REGISTRATION = true;
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = true;
|
||||
SHOW_REGISTRATION_BUTTON = false;
|
||||
};
|
||||
ui = {
|
||||
DEFAULT_THEME = "catppuccin-mocha-mauve";
|
||||
THEMES = "catppuccin-latte-mauve,catppuccin-frappe-mauve,catppuccin-macchiato-mauve,catppuccin-mocha-mauve";
|
||||
};
|
||||
explore = {
|
||||
DISABLE_USERS_PAGE = true;
|
||||
DISABLE_ORGANIZATIONS_PAGE = true;
|
||||
};
|
||||
repository.DISABLE_STARS = true;
|
||||
mailer.ENABLED = false;
|
||||
api.ENABLE_SWAGGER = false;
|
||||
other.SHOW_FOOTER_VERSION = false;
|
||||
};
|
||||
};
|
||||
ui = {
|
||||
DEFAULT_THEME = "catppuccin-mocha-mauve";
|
||||
THEMES = "catppuccin-latte-mauve,catppuccin-frappe-mauve,catppuccin-macchiato-mauve,catppuccin-mocha-mauve";
|
||||
};
|
||||
explore = {
|
||||
DISABLE_USERS_PAGE = true;
|
||||
DISABLE_ORGANIZATIONS_PAGE = true;
|
||||
};
|
||||
repository = {
|
||||
DISABLE_STARS = true;
|
||||
};
|
||||
mailer = {ENABLED = false;};
|
||||
api = {ENABLE_SWAGGER = false;};
|
||||
other = {SHOW_FOOTER_VERSION = false;};
|
||||
|
||||
systemd.services.gitea.preStart = lib.mkAfter ''
|
||||
mkdir -p /var/lib/gitea/custom/public/assets
|
||||
ln -sfn ${catppuccin-gitea} /var/lib/gitea/custom/public/assets/css
|
||||
'';
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 3002 ];
|
||||
system.stateVersion = "24.05";
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
cloudflared.tunnels."${config.var.tunnelId}".ingress."git.${config.var.domain}" = "http://localhost:3002";
|
||||
};
|
||||
|
||||
systemd.services.gitea.preStart = lib.mkAfter ''
|
||||
mkdir -p ${config.services.gitea.stateDir}/custom/public/assets
|
||||
ln -sfn ${catppuccin-gitea} ${config.services.gitea.stateDir}/custom/public/assets/css
|
||||
'';
|
||||
services.cloudflared.tunnels."${config.var.tunnelId}".ingress."git.${domain}" = "http://10.233.11.2:3002";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user