test module
This commit is contained in:
parent
b535861ad5
commit
a78eae334b
73
pp-gitea.nix
Normal file
73
pp-gitea.nix
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfgBase = config.base;
|
||||||
|
cfg = config.services.ppGitea;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.ppGitea = {
|
||||||
|
baseModule = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = builtins.fetchurl {
|
||||||
|
url = "https://git.mineau.eu/histausse/nixos-modules/raw/branch/master/base.nix";
|
||||||
|
sha256 = "1iiz2igsklw8nhmng3gxpjgy47n9hivzlrpwmxy2rw8aziax1cgz";
|
||||||
|
};
|
||||||
|
description = "The base module to use";
|
||||||
|
};
|
||||||
|
domain = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "git.${cfgBase.domainName}";
|
||||||
|
example = "git.example.com";
|
||||||
|
description = "The domain of the server";
|
||||||
|
};
|
||||||
|
disableRegistration = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Must be set to `false` for the initial deployement";
|
||||||
|
};
|
||||||
|
customPackage = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.fetchgit {
|
||||||
|
url = "https://git.mineau.eu/histausse/gitea_custom";
|
||||||
|
sha256 = "0r1kjkn0mkfyp2lb8j59frh1vnd1m54swpqwiasvg77r04ibfmn5";
|
||||||
|
};
|
||||||
|
description= "The package for custom configs like theme.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
cfg.baseModule
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
services.gitea.appName = "git";
|
||||||
|
services.gitea.stateDir = "/var/lib/gitea"; # default value
|
||||||
|
services.gitea.enable = true;
|
||||||
|
services.gitea.rootUrl = "https://git.${cfg.domain}/";
|
||||||
|
services.gitea.settings.service.DISABLE_REGISTRATION = lib.mkForce cfg.disableRegistration; # Only set after initial deploy
|
||||||
|
services.gitea.settings.session.COOKIE_SECURE = lib.mkForce true; # Why do I need to override this???
|
||||||
|
services.gitea.lfs.enable = true;
|
||||||
|
services.gitea.domain = cfg.domain;
|
||||||
|
# services.gitea.database.type = "postgres"; # Default is sqlite3, probably better for a small instance
|
||||||
|
services.gitea.database.passwordFile = "/var/lib/gitea/gitea-dbpassword";
|
||||||
|
networking.firewall.allowedTCPPorts = [ 3000 ];
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
gitea
|
||||||
|
];
|
||||||
|
systemd.services.gitea.environment.GITEA_CUSTOM = "${config.services.gitea.stateDir}/custom";
|
||||||
|
systemd.services.gitea.preStart = lib.mkAfter ''
|
||||||
|
find ${config.services.gitea.stateDir}/ -type d -exec chmod u+w {} \;
|
||||||
|
cp -f -s -r ${cfg.customPackage}/* ${config.services.gitea.stateDir}/custom/
|
||||||
|
'';
|
||||||
|
services.gitea.settings = {
|
||||||
|
ui = {
|
||||||
|
THEMES = "gitea,arc-green,plex,aquamarine,dark,dracula,hotline,organizr,space-gray,hotpink,onedark,overseerr,nord";
|
||||||
|
DEFAULT_THEME = "dark";
|
||||||
|
};
|
||||||
|
"ui.meta" = {
|
||||||
|
DESCRIPTION = "Code everywhere";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue