feat: Dynamic templating

This commit is contained in:
Inex Code
2024-12-18 15:40:15 +03:00
parent 7b69b39bff
commit cca51699ee
36 changed files with 802 additions and 43 deletions

View File

@@ -5,5 +5,27 @@
nixosModules.default = import ./module.nix;
configPathsNeeded =
builtins.fromJSON (builtins.readFile ./config-paths-needed.json);
meta = { lib, ... }: {
spModuleVersion = 1;
id = "gitea";
name = "Forgejo";
description = "Forgejo is a Git forge.";
svgIcon = builtins.readFile ./icon.svg;
isMovable = true;
isRequired = false;
backupDescription = "Git repositories, database and user data.";
systemdServices = [
"forgejo.service"
];
folders = [
"/var/lib/gitea"
];
license = [
lib.licenses.gpl3Plus
];
homepage = "https://forgejo.org";
sourcePage = "https://codeberg.org/forgejo/forgejo";
supportLevel = "normal";
};
};
}

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.60007 10.5899L8.38007 4.79995L10.0701 6.49995C9.83007 7.34995 10.2201 8.27995 11.0001 8.72995V14.2699C10.4001 14.6099 10.0001 15.2599 10.0001 15.9999C10.0001 16.5304 10.2108 17.0391 10.5859 17.4142C10.9609 17.7892 11.4696 17.9999 12.0001 17.9999C12.5305 17.9999 13.0392 17.7892 13.4143 17.4142C13.7894 17.0391 14.0001 16.5304 14.0001 15.9999C14.0001 15.2599 13.6001 14.6099 13.0001 14.2699V9.40995L15.0701 11.4999C15.0001 11.6499 15.0001 11.8199 15.0001 11.9999C15.0001 12.5304 15.2108 13.0391 15.5859 13.4142C15.9609 13.7892 16.4696 13.9999 17.0001 13.9999C17.5305 13.9999 18.0392 13.7892 18.4143 13.4142C18.7894 13.0391 19.0001 12.5304 19.0001 11.9999C19.0001 11.4695 18.7894 10.9608 18.4143 10.5857C18.0392 10.2107 17.5305 9.99995 17.0001 9.99995C16.8201 9.99995 16.6501 9.99995 16.5001 10.0699L13.9301 7.49995C14.1901 6.56995 13.7101 5.54995 12.7801 5.15995C12.3501 4.99995 11.9001 4.95995 11.5001 5.06995L9.80007 3.37995L10.5901 2.59995C11.3701 1.80995 12.6301 1.80995 13.4101 2.59995L21.4001 10.5899C22.1901 11.3699 22.1901 12.6299 21.4001 13.4099L13.4101 21.3999C12.6301 22.1899 11.3701 22.1899 10.5901 21.3999L2.60007 13.4099C1.81007 12.6299 1.81007 11.3699 2.60007 10.5899Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -6,47 +6,106 @@ let
then "/volumes/${cfg.location}/gitea"
else "/var/lib/gitea";
cfg = sp.modules.gitea;
themes = [
"forgejo-auto"
"forgejo-light"
"forgejo-dark"
"gitea-auto"
"gitea-light"
"gitea-dark"
];
in
{
options.selfprivacy.modules.gitea = {
enable = lib.mkOption {
enable = (lib.mkOption {
default = false;
type = lib.types.bool;
description = "Enable Forgejo";
}) // {
meta = {
type = "enable";
};
};
location = lib.mkOption {
location = (lib.mkOption {
type = lib.types.str;
description = "Forgejo location";
}) // {
meta = {
type = "location";
};
};
subdomain = lib.mkOption {
subdomain = (lib.mkOption {
default = "git";
type = lib.types.strMatching "[A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]";
description = "Subdomain";
}) // {
meta = {
widget = "subdomain";
type = "string";
regex = "[A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]";
weight = 0;
};
};
appName = lib.mkOption {
appName = (lib.mkOption {
default = "SelfPrivacy git Service";
type = lib.types.str;
description = "The name displayed in the web interface";
}) // {
meta = {
type = "string";
weight = 1;
};
};
enableLfs = lib.mkOption {
enableLfs = (lib.mkOption {
default = true;
type = lib.types.bool;
description = "Enable Git LFS";
}) // {
meta = {
type = "bool";
weight = 2;
};
};
forcePrivate = lib.mkOption {
forcePrivate = (lib.mkOption {
default = false;
type = lib.types.bool;
description = "Force all new repositories to be private";
}) // {
meta = {
type = "bool";
weight = 3;
};
};
disableRegistration = lib.mkOption {
disableRegistration = (lib.mkOption {
default = false;
type = lib.types.bool;
description = "Disable registration of new users";
}) // {
meta = {
type = "bool";
weight = 4;
};
};
requireSigninView = lib.mkOption {
requireSigninView = (lib.mkOption {
default = false;
type = lib.types.bool;
description = "Require signin to view any page";
description = "Force users to log in to view any page";
}) // {
meta = {
type = "bool";
weight = 5;
};
};
defaultTheme = lib.mkOption {
defaultTheme = (lib.mkOption {
default = "forgejo-auto";
type = lib.types.enum [ "forgejo-auto" "forgejo-light" "forgejo-dark" "auto" "gitea" "arc-green" ];
description = "The default theme for the gitea instance";
type = lib.types.enum themes;
description = "Default theme";
}) // {
meta = {
type = "enum";
options = themes;
weight = 6;
};
};
};