Compare commits

...

2 commits

Author SHA1 Message Date
Natsu Kagami 7f1f963d5e
Move gitea to forgejo 2024-07-03 20:41:25 +02:00
Natsu Kagami 9c64c4dca9
Update nixpkgs 2024-07-03 19:54:13 +02:00
2 changed files with 39 additions and 23 deletions

View file

@ -995,11 +995,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1718983919,
"narHash": "sha256-+1xgeIow4gJeiwo4ETvMRvWoircnvb0JOt7NS9kUhoM=",
"lastModified": 1719826879,
"narHash": "sha256-xs7PlULe8O1SAcs/9e/HOjeUjBrU5FNtkAF/bSEcFto=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "90338afd6177fc683a04d934199d693708c85a3b",
"rev": "b9014df496d5b68bf7c0145d0e9b0f529ce4f2a8",
"type": "github"
},
"original": {
@ -1155,11 +1155,11 @@
},
"nixpkgs_9": {
"locked": {
"lastModified": 1718437845,
"narHash": "sha256-ZT7Oc1g4I4pHVGGjQFnewFVDRLH5cIZhEzODLz9YXeY=",
"lastModified": 1719707984,
"narHash": "sha256-RoxIr/fbndtuKqulGvNCcuzC6KdAib85Q8gXnjzA1dw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "752c634c09ceb50c45e751f8791cb45cb3d46c9e",
"rev": "7dca15289a1c2990efbe4680f0923ce14139b042",
"type": "github"
},
"original": {

View file

@ -9,10 +9,27 @@ let
signingKey = "0x3681E15E5C14A241";
catppuccinThemes = builtins.fetchurl {
url = "https://github.com/catppuccin/gitea/releases/download/v0.2.1/catppuccin-gitea.tar.gz";
sha256 = "sha256:18l67whffayrgylsf5j6g7sj95anjcjl0cy7fzqn1wrm0gg2xns0";
catppuccinThemes = pkgs.fetchurl {
url = "https://github.com/catppuccin/gitea/releases/download/v0.4.1/catppuccin-gitea.tar.gz";
hash = "sha256-/P4fLvswitlfeaKaUykrEKvjbNpw5Q/nzGQ/GZaLyUI=";
};
staticDir = pkgs.runCommandLocal "forgejo-static" { } ''
mkdir -p $out
tmp=$(mktemp -d)
cp -r ${config.services.forgejo.package.data}/* $tmp
chmod -R +w $tmp
# Copy icons
install -m 0644 ${./gitea/img}/* $tmp/public/assets/img
# Copy the themes
env PATH=${pkgs.gzip}/bin:${pkgs.gnutar}/bin:$PATH \
tar -xvf ${catppuccinThemes} -C $tmp/public/assets/css
cp -r $tmp/* $out
'';
default-themes = "forgejo-auto, forgejo-light, forgejo-dark, gitea-auto, gitea-light, gitea-dark, forgejo-auto-deuteranopia-protanopia, forgejo-light-deuteranopia-protanopia, forgejo-dark-deuteranopia-protanopia, forgejo-auto-tritanopia, forgejo-light-tritanopia, forgejo-dark-tritanopia";
themes = strings.concatStringsSep ", " [
"catppuccin-macchiato-green"
"catppuccin-mocha-teal"
@ -73,6 +90,13 @@ let
];
in
{
users.users.${user} = {
home = config.services.forgejo.stateDir;
useDefaultShell = true;
isSystemUser = true;
group = user;
};
users.groups.${user} = { };
sops.secrets."gitea/signing-key".owner = user;
sops.secrets."gitea/mailer-password".owner = user;
# database
@ -83,9 +107,9 @@ in
noCloudflare = true;
};
systemd.services.gitea.requires = [ "postgresql.service" ];
systemd.services.forgejo.requires = [ "postgresql.service" ];
services.gitea = {
services.forgejo = {
enable = true;
inherit user;
@ -98,6 +122,7 @@ in
ROOT_URL = "https://${host}/";
HTTP_ADDRESS = "127.0.0.1";
HTTP_PORT = port;
STATIC_ROOT_PATH = staticDir;
};
repository = {
DEFAULT_PRIVATE = "private";
@ -114,7 +139,7 @@ in
SIGNING_NAME = "DTTHGit";
SIGNING_EMAIL = "dtth-gitea@nkagami.me";
};
ui.THEMES = "auto,gitea,arc-green," + themes;
ui.THEMES = default-themes + "," + themes;
"ui.meta" = {
AUTHOR = "DTTHgit - Gitea instance for GTTH";
DESCRIPTION = "DTTHGit is a custom Gitea instance hosted for DTTH members only.";
@ -175,7 +200,7 @@ in
};
# Set up gpg signing key
systemd.services.gitea = {
systemd.services.forgejo = {
path = with pkgs; [ gnupg ];
environment.GNUPGHOME = "${config.services.gitea.stateDir}/.gnupg";
# https://github.com/NixOS/nixpkgs/commit/93c1d370db28ad4573fb9890c90164ba55391ce7
@ -191,15 +216,6 @@ in
echo "trusted-key ${signingKey}" >> ${config.services.gitea.stateDir}/.gnupg/gpg.conf
exit 1
fi
# Copy icons
mkdir -p ${config.services.gitea.stateDir}/custom/public/img
install -m 0644 ${./gitea/img}/* ${config.services.gitea.stateDir}/custom/public/img
# Copy the themes
mkdir -p ${config.services.gitea.stateDir}/custom/public/css
env PATH=${pkgs.gzip}/bin:${pkgs.gnutar}/bin:$PATH \
tar -xvf ${catppuccinThemes} -C ${config.services.gitea.stateDir}/custom/public/css/
'';
};
}