From ad9dd1eecb6cb3978407850fc9516d3c9ba9e3d1 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 5 Nov 2022 11:08:15 -0700 Subject: Revert "ref(gitea): remove all modules for gitea" This reverts commit f4f83c7e83272234571d9580f5a897676de3d0dc. I'm planning to switch back to gitea to host my projects. --- modules/services/gitea/default.nix | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 modules/services/gitea/default.nix (limited to 'modules/services/gitea') diff --git a/modules/services/gitea/default.nix b/modules/services/gitea/default.nix new file mode 100644 index 0000000..ece75de --- /dev/null +++ b/modules/services/gitea/default.nix @@ -0,0 +1,64 @@ +{ config, pkgs, lib, ... }: +let cfg = config.my.services.gitea; +in +{ + options.my.services.gitea = with lib; { + enable = mkEnableOption "gitea git server"; + stateDir = mkOption { + type = types.str; + example = "/var/lib/gitea"; + description = "gitea base directory"; + }; + }; + + config = lib.mkIf cfg.enable { + users.users.git = { + description = "Gitea Service"; + home = cfg.stateDir; + useDefaultShell = true; + group = "git"; + isSystemUser = true; + }; + users.groups.git = { }; + + services.gitea = { + enable = true; + user = "git"; + domain = "git.fcuny.net"; + appName = "git.fcuny.net"; + rootUrl = "https://git.fcuny.net/"; + httpAddress = "127.0.0.1"; + httpPort = 8002; + log.level = "Error"; + settings = { + other.SHOW_FOOTER_VERSION = false; + metrics.ENABLED = true; + metrics.ENABLED_ISSUE_BY_REPOSITORY = true; + }; + dump.enable = false; + database = { + type = "sqlite3"; + user = "git"; + }; + }; + + services.nginx.virtualHosts."git.fcuny.net" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8002"; + proxyWebsockets = true; + }; + }; + + services.prometheus.scrapeConfigs = [{ + job_name = "gitea"; + metrics_path = "/metrics"; + scheme = "https"; + scrape_interval = "30s"; + static_configs = [{ targets = [ "git.fcuny.net" ]; }]; + }]; + + my.services.backup = { paths = [ cfg.stateDir ]; }; + }; +} -- cgit 1.4.1