mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-02-20 17:07:51 +01:00
Compare commits
1 Commits
0d40c7d7a7
...
shellcheck
| Author | SHA1 | Date | |
|---|---|---|---|
| 81b458d59c |
@@ -2,7 +2,7 @@
|
||||
{
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "acme-drift@pvv.ntnu.no";
|
||||
defaults.email = "drift@pvv.ntnu.no";
|
||||
};
|
||||
|
||||
# Let's not spam LetsEncrypt in `nixos-rebuild build-vm` mode:
|
||||
|
||||
8
flake.lock
generated
8
flake.lock
generated
@@ -195,11 +195,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770960722,
|
||||
"narHash": "sha256-IdhPsWFZUKSJh/nLjGLJvGM5d5Uta+k1FlVYPxTZi0E=",
|
||||
"lastModified": 1767906352,
|
||||
"narHash": "sha256-wYsH9MMAPFG3XTL+3DwI39XMG0F2fTmn/5lt265a3Es=",
|
||||
"ref": "main",
|
||||
"rev": "c2e4aca7e1ba27cd09eeaeab47010d32a11841b2",
|
||||
"revCount": 15,
|
||||
"rev": "d054c5d064b8ed6d53a0adb0cf6c0a72febe212e",
|
||||
"revCount": 13,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git"
|
||||
},
|
||||
|
||||
@@ -47,8 +47,8 @@ in {
|
||||
}}
|
||||
|
||||
# Delete files and directories that exists in the gallery that don't exist in the tarball
|
||||
filesToRemove=$(uniq -u <(sort <(find . -not -path "./.thumbnails*") <(tar -tf ${transferDir}/gallery.tar.gz | sed 's|/$||')))
|
||||
while IFS= read fname; do
|
||||
filesToRemove=$(uniq -u <(sort <(find . -not -path "./.thumbnails*") <(tar -tf "${transferDir}/gallery.tar.gz" | sed 's|/$||')))
|
||||
while IFS= read -r fname; do
|
||||
rm -f "$fname" ||:
|
||||
rm -f ".thumbnails/$fname.png" ||:
|
||||
done <<< "$filesToRemove"
|
||||
@@ -58,7 +58,7 @@ in {
|
||||
mkdir -p .thumbnails
|
||||
images=$(find . -type f -not -path "./.thumbnails*")
|
||||
|
||||
while IFS= read fname; do
|
||||
while IFS= read -r fname; do
|
||||
# Skip this file if an up-to-date thumbnail already exists
|
||||
if [ -f ".thumbnails/$fname.png" ] && \
|
||||
[ "$(date -R -r "$fname")" == "$(date -R -r ".thumbnails/$fname.png")" ]
|
||||
@@ -67,7 +67,7 @@ in {
|
||||
fi
|
||||
|
||||
echo "Creating thumbnail for $fname"
|
||||
mkdir -p $(dirname ".thumbnails/$fname")
|
||||
mkdir -p "$(dirname ".thumbnails/$fname")"
|
||||
magick -define jpeg:size=200x200 "$fname" -thumbnail 300 -auto-orient ".thumbnails/$fname.png" ||:
|
||||
touch -m -d "$(date -R -r "$fname")" ".thumbnails/$fname.png"
|
||||
done <<< "$images"
|
||||
|
||||
@@ -43,7 +43,7 @@ in
|
||||
keyFile = config.sops.templates."matrix-livekit-keyfile".path;
|
||||
};
|
||||
|
||||
systemd.services.lk-jwt-service.environment.LIVEKIT_FULL_ACCESS_HOMESERVERS = lib.mkIf cfg.enable (builtins.concatStringsSep "," [ "pvv.ntnu.no" "dodsorf.as" ]);
|
||||
systemd.services.lk-jwt-service.environment.LIVEKIT_FULL_ACCESS_HOMESERVERS = lib.mkIf cfg.enable matrixDomain;
|
||||
|
||||
services.nginx.virtualHosts.${matrixDomain} = lib.mkIf cfg.enable {
|
||||
locations."^~ /livekit/jwt/" = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, pkgs, lib, values, fp, ... }:
|
||||
{ config, pkgs, fp, ... }:
|
||||
let
|
||||
cfg = config.services.matrix-ooye;
|
||||
in
|
||||
@@ -28,23 +28,6 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services.rsync-pull-targets = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
locations."/var/lib/private/matrix-ooye" = {
|
||||
user = "root";
|
||||
rrsyncArgs.ro = true;
|
||||
authorizedKeysAttrs = [
|
||||
"restrict"
|
||||
"from=\"principal.pvv.ntnu.no,${values.hosts.principal.ipv6},${values.hosts.principal.ipv4}\""
|
||||
"no-agent-forwarding"
|
||||
"no-port-forwarding"
|
||||
"no-pty"
|
||||
"no-X11-forwarding"
|
||||
];
|
||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE5koYfor5+kKB30Dugj3dAWvmj8h/akQQ2XYDvLobFL matrix_ooye rsync backup";
|
||||
};
|
||||
};
|
||||
|
||||
services.matrix-ooye = {
|
||||
enable = true;
|
||||
homeserver = "https://matrix.pvv.ntnu.no";
|
||||
|
||||
@@ -57,7 +57,7 @@ in
|
||||
rm "$STATE_DIRECTORY/mysql-dump-latest.sql.zst" ||:
|
||||
ln -T "$OUT_FILE" "$STATE_DIRECTORY/mysql-dump-latest.sql.zst"
|
||||
|
||||
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt ${toString (rotations + 1)} ]; do
|
||||
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt "${toString (rotations + 1)}" ]; do
|
||||
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
|
||||
done
|
||||
'';
|
||||
|
||||
@@ -58,7 +58,7 @@ in
|
||||
rm "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ||:
|
||||
ln -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst"
|
||||
|
||||
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt ${toString (rotations + 1)} ]; do
|
||||
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt "${toString (rotations + 1)}" ]; do
|
||||
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
|
||||
done
|
||||
'';
|
||||
|
||||
@@ -10,59 +10,6 @@ in
|
||||
catppuccin = pkgs.gitea-theme-catppuccin;
|
||||
};
|
||||
|
||||
services.gitea.settings = {
|
||||
ui = {
|
||||
DEFAULT_THEME = "gitea-auto";
|
||||
REACTIONS = lib.concatStringsSep "," [
|
||||
"+1"
|
||||
"-1"
|
||||
"laugh"
|
||||
"confused"
|
||||
"heart"
|
||||
"hooray"
|
||||
"rocket"
|
||||
"eyes"
|
||||
"100"
|
||||
"anger"
|
||||
"astonished"
|
||||
"no_good"
|
||||
"ok_hand"
|
||||
"pensive"
|
||||
"pizza"
|
||||
"point_up"
|
||||
"sob"
|
||||
"skull"
|
||||
"upside_down_face"
|
||||
"shrug"
|
||||
"huh"
|
||||
"bruh"
|
||||
"okiedokie"
|
||||
"grr"
|
||||
];
|
||||
|
||||
CUSTOM_EMOJIS = lib.concatStringsSep "," [
|
||||
"bruh"
|
||||
"grr"
|
||||
"huh"
|
||||
"ohyeah"
|
||||
];
|
||||
};
|
||||
"ui.meta" = {
|
||||
AUTHOR = "Programvareverkstedet";
|
||||
DESCRIPTION = "Bokstavelig talt programvareverkstedet";
|
||||
KEYWORDS = lib.concatStringsSep "," [
|
||||
"git"
|
||||
"hackerspace"
|
||||
"nix"
|
||||
"open source"
|
||||
"foss"
|
||||
"organization"
|
||||
"software"
|
||||
"student"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.gitea-customization = lib.mkIf cfg.enable {
|
||||
description = "Install extra customization in gitea's CUSTOM_DIR";
|
||||
wantedBy = [ "gitea.service" ];
|
||||
@@ -103,19 +50,14 @@ in
|
||||
sed -i -e 's/24/60/g' "$out/repo/icon.tmpl"
|
||||
'';
|
||||
in ''
|
||||
install -Dm444 ${logo-svg} ${cfg.customDir}/public/assets/img/logo.svg
|
||||
install -Dm444 ${logo-png} ${cfg.customDir}/public/assets/img/logo.png
|
||||
install -Dm444 ${./loading.apng} ${cfg.customDir}/public/assets/img/loading.png
|
||||
install -Dm444 ${extraLinks} ${cfg.customDir}/templates/custom/extra_links.tmpl
|
||||
install -Dm444 ${extraLinksFooter} ${cfg.customDir}/templates/custom/extra_links_footer.tmpl
|
||||
install -Dm444 ${project-labels} ${cfg.customDir}/options/label/project-labels.yaml
|
||||
install -Dm444 ${logo-svg} "${cfg.customDir}/public/assets/img/logo.svg"
|
||||
install -Dm444 ${logo-png} "${cfg.customDir}/public/assets/img/logo.png"
|
||||
install -Dm444 ${./loading.apng} "${cfg.customDir}/public/assets/img/loading.png"
|
||||
install -Dm444 ${extraLinks} "${cfg.customDir}/templates/custom/extra_links.tmpl"
|
||||
install -Dm444 ${extraLinksFooter} "${cfg.customDir}/templates/custom/extra_links_footer.tmpl"
|
||||
install -Dm444 ${project-labels} "${cfg.customDir}/options/label/project-labels.yaml"
|
||||
|
||||
install -Dm644 ${./emotes/bruh.png} ${cfg.customDir}/public/assets/img/emoji/bruh.png
|
||||
install -Dm644 ${./emotes/huh.gif} ${cfg.customDir}/public/assets/img/emoji/huh.png
|
||||
install -Dm644 ${./emotes/grr.png} ${cfg.customDir}/public/assets/img/emoji/grr.png
|
||||
install -Dm644 ${./emotes/okiedokie.jpg} ${cfg.customDir}/public/assets/img/emoji/okiedokie.png
|
||||
|
||||
"${lib.getExe pkgs.rsync}" -a "${customTemplates}/" ${cfg.customDir}/templates/
|
||||
"${lib.getExe pkgs.rsync}" -a "${customTemplates}/" "${cfg.customDir}/templates/"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 206 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 145 KiB |
@@ -83,24 +83,11 @@ in {
|
||||
AUTO_WATCH_NEW_REPOS = false;
|
||||
};
|
||||
admin.DEFAULT_EMAIL_NOTIFICATIONS = "onmention";
|
||||
session.COOKIE_SECURE = true;
|
||||
security = {
|
||||
SECRET_KEY = lib.mkForce "";
|
||||
SECRET_KEY_URI = "file:${config.sops.secrets."gitea/secret-key".path}";
|
||||
};
|
||||
cache = {
|
||||
ADAPTER = "redis";
|
||||
HOST = "redis+socket://${config.services.redis.servers.gitea.unixSocket}?db=0";
|
||||
ITEM_TTL = "72h";
|
||||
};
|
||||
session = {
|
||||
COOKIE_SECURE = true;
|
||||
PROVIDER = "redis";
|
||||
PROVIDER_CONFIG = "redis+socket://${config.services.redis.servers.gitea.unixSocket}?db=1";
|
||||
};
|
||||
queue = {
|
||||
TYPE = "redis";
|
||||
CONN_STR = "redis+socket://${config.services.redis.servers.gitea.unixSocket}?db=2";
|
||||
};
|
||||
database.LOG_SQL = false;
|
||||
repository = {
|
||||
PREFERRED_LICENSES = lib.concatStringsSep "," [
|
||||
@@ -141,6 +128,31 @@ in {
|
||||
AVATAR_MAX_ORIGIN_SIZE = 1024 * 1024 * 2;
|
||||
};
|
||||
actions.ENABLED = true;
|
||||
ui = {
|
||||
REACTIONS = lib.concatStringsSep "," [
|
||||
"+1"
|
||||
"-1"
|
||||
"laugh"
|
||||
"confused"
|
||||
"heart"
|
||||
"hooray"
|
||||
"rocket"
|
||||
"eyes"
|
||||
"100"
|
||||
"anger"
|
||||
"astonished"
|
||||
"no_good"
|
||||
"ok_hand"
|
||||
"pensive"
|
||||
"pizza"
|
||||
"point_up"
|
||||
"sob"
|
||||
"skull"
|
||||
"upside_down_face"
|
||||
"shrug"
|
||||
];
|
||||
};
|
||||
"ui.meta".DESCRIPTION = "Bokstavelig talt programvareverkstedet";
|
||||
};
|
||||
|
||||
dump = {
|
||||
@@ -152,26 +164,12 @@ in {
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
systemd.services.gitea = lib.mkIf cfg.enable {
|
||||
wants = [ "redis-gitea.service" ];
|
||||
after = [ "redis-gitea.service" ];
|
||||
systemd.services.gitea.serviceConfig.CPUSchedulingPolicy = "batch";
|
||||
|
||||
serviceConfig = {
|
||||
CPUSchedulingPolicy = "batch";
|
||||
CacheDirectory = "gitea/repo-archive";
|
||||
BindPaths = [
|
||||
systemd.services.gitea.serviceConfig.CacheDirectory = "gitea/repo-archive";
|
||||
systemd.services.gitea.serviceConfig.BindPaths = [
|
||||
"%C/gitea/repo-archive:${cfg.stateDir}/data/repo-archive"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.redis.servers.gitea = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
user = config.services.gitea.user;
|
||||
save = [ ];
|
||||
openFirewall = false;
|
||||
port = 5698;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${domain}" = {
|
||||
forceSSL = true;
|
||||
|
||||
@@ -81,7 +81,7 @@ in
|
||||
|
||||
if [[ ! -f ''${REGISTRATION_FILE} ]]; then
|
||||
echo "No registration file found at '$REGISTRATION_FILE'"
|
||||
cp --no-preserve=mode,ownership ${baseConfig} ''${REGISTRATION_FILE}
|
||||
cp --no-preserve=mode,ownership "${baseConfig}" ''${REGISTRATION_FILE}
|
||||
fi
|
||||
|
||||
echo "After if statement"
|
||||
@@ -116,7 +116,7 @@ in
|
||||
fi
|
||||
|
||||
shred -u ''${REGISTRATION_FILE}
|
||||
cp --no-preserve=mode,ownership ${baseConfig} ''${REGISTRATION_FILE}
|
||||
cp --no-preserve=mode,ownership "${baseConfig}" ''${REGISTRATION_FILE}
|
||||
|
||||
${lib.getExe pkgs.jq} '.as_token = "'$AS_TOKEN'" | .hs_token = "'$HS_TOKEN'" | .ooye.discord_token = "'$DISCORD_TOKEN'" | .ooye.discord_client_secret = "'$DISCORD_CLIENT_SECRET'"' ''${REGISTRATION_FILE} > ''${REGISTRATION_FILE}.tmp
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ in
|
||||
script = let
|
||||
openssl = lib.getExe pkgs.openssl;
|
||||
in lib.concatMapStringsSep "\n" ({ name, value }: ''
|
||||
mkdir -p $(dirname "${value.certificate}") $(dirname "${value.certificateKey}")
|
||||
if ! ${openssl} x509 -checkend 86400 -noout -in ${value.certificate}
|
||||
mkdir -p "$(dirname "${value.certificate}")" "$(dirname "${value.certificateKey}")"
|
||||
if ! ${openssl} x509 -checkend 86400 -noout -in "${value.certificate}"
|
||||
then
|
||||
echo "Regenerating '${value.certificate}'"
|
||||
${openssl} req \
|
||||
|
||||
Reference in New Issue
Block a user