mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-01-13 19:08:25 +01:00
Compare commits
5 Commits
df5557698f
...
gitea-vask
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd5cb05ecf | ||
|
|
3faad36418 | ||
|
|
0b74907f76 | ||
|
|
bacfdeff23 | ||
|
|
9e51bdb373 |
@@ -22,7 +22,8 @@ let
|
||||
port = 9102;
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${config.networking.fqdn}" = {
|
||||
services.nginx.virtualHosts."${config.networking.fqdn}-nixos-metrics" = {
|
||||
serverName = config.networking.fqdn;
|
||||
serverAliases = [
|
||||
"${config.networking.hostName}.pvv.org"
|
||||
];
|
||||
@@ -41,7 +42,9 @@ in
|
||||
];
|
||||
extraConfig = ''
|
||||
allow ${values.hosts.ildkule.ipv4}/32;
|
||||
allow ${values.hosts.ildkule.ipv6}/32;
|
||||
allow ${values.hosts.ildkule.ipv6}/128;
|
||||
allow 127.0.0.1/32;
|
||||
allow ::1/128;
|
||||
allow 129.241.210.128/25;
|
||||
allow 2001:700:300:1900::/64;
|
||||
deny all;
|
||||
|
||||
16
flake.lock
generated
16
flake.lock
generated
@@ -159,11 +159,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1760181981,
|
||||
"narHash": "sha256-xDZe6SFMbTcnDIdcYixiDgAEuk95qamQqSQN2AHwH3A=",
|
||||
"rev": "848c3a9fbba628987c98256fa34c6e2927ee1bde",
|
||||
"lastModified": 1760254360,
|
||||
"narHash": "sha256-Npp92Joy2bRyickrrVP9+85z31aGS8kVNiLlKvd5pC4=",
|
||||
"rev": "bafe987a29b8bea2edbb3aba76b51464b3d222f0",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/25.05-small/nixos-25.05.811127.848c3a9fbba6/nixexprs.tar.xz"
|
||||
"url": "https://releases.nixos.org/nixos/25.05-small/nixos-25.05.811161.bafe987a29b8/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
@@ -172,11 +172,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1760170014,
|
||||
"narHash": "sha256-oP2fv8Vl0sYauPVmIFwMnNl0Nw8+ZJ2Cm1vaeS9t1to=",
|
||||
"rev": "e18d8ec6fafaed55561b7a1b54eb1c1ce3ffa2c5",
|
||||
"lastModified": 1760252326,
|
||||
"narHash": "sha256-5v32B25kSE++E+KtP4DO687r/AlWL9qOlOjtYyfcDSw=",
|
||||
"rev": "66e5020bfe0af40ffa127426f8405edbdadbb40b",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable-small/nixos-25.11pre875961.e18d8ec6fafa/nixexprs.tar.xz"
|
||||
"url": "https://releases.nixos.org/nixos/unstable-small/nixos-25.11pre876242.66e5020bfe0a/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
|
||||
@@ -77,7 +77,7 @@ in
|
||||
outbound = true;
|
||||
urlPrefix = "https://hookshot.pvv.ntnu.no/webhook/";
|
||||
userIdPrefix = "_webhooks_";
|
||||
allowJsTransformationFunctions = false;
|
||||
allowJsTransformationFunctions = true;
|
||||
waitForComplete = false;
|
||||
};
|
||||
feeds = {
|
||||
@@ -94,6 +94,11 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
widgets = {
|
||||
roomSetupWidget.addOnInvite = false;
|
||||
publicUrl = "https://hookshot.pvv.ntnu.no/widgetapi/v1/static";
|
||||
};
|
||||
|
||||
permissions = [
|
||||
# Users of the PVV Server
|
||||
{ actor = "pvv.ntnu.no";
|
||||
@@ -128,6 +133,7 @@ in
|
||||
|
||||
services.nginx.virtualHosts."hookshot.pvv.ntnu.no" = {
|
||||
enableACME = true;
|
||||
addSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://${webhookListenAddress}:${toString webhookListenPort}";
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ in {
|
||||
./customization
|
||||
./gpg.nix
|
||||
./import-users
|
||||
./vaskepersonalet.nix
|
||||
./web-secret-provider
|
||||
];
|
||||
|
||||
|
||||
59
hosts/kommode/services/gitea/vaskepersonalet.nix
Normal file
59
hosts/kommode/services/gitea/vaskepersonalet.nix
Normal file
@@ -0,0 +1,59 @@
|
||||
{ config, ... }:
|
||||
let
|
||||
cfg = config.services.gitea;
|
||||
cacheDir = "/var/cache/${config.systemd.services.gitea.serviceConfig.CacheDirectory}";
|
||||
in
|
||||
{
|
||||
systemd.services."gitea-vaskepersonalet" = {
|
||||
description = "yeeet";
|
||||
startAt = "hourly";
|
||||
|
||||
serviceConfig = rec {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
|
||||
RuntimeDirectory = "gitea-vaskepersonalet";
|
||||
RootDirectory = "/run/${RuntimeDirectory}";
|
||||
|
||||
BindPaths = [
|
||||
builtins.storeDir
|
||||
cacheDir
|
||||
cfg.dump.backupDir
|
||||
];
|
||||
};
|
||||
|
||||
script = let
|
||||
percentageLimit = 80;
|
||||
in ''
|
||||
USED=$(df --output=pcent '${cacheDir}' | grep '[0-9]' | tr -d '%')
|
||||
if [[ $USED -lt ${toString percentageLimit} ]]; then exit 0; fi
|
||||
|
||||
echo "omg omg, we're running out of space, imma yeet the cache"
|
||||
|
||||
rm -rf '${cacheDir}'/*
|
||||
echo "yeetus deletus"
|
||||
|
||||
USED=$(df --output=pcent '${cacheDir}' | grep '[0-9]' | tr -d '%')
|
||||
if [[ $USED -lt ${toString percentageLimit} ]]; then exit 0; fi
|
||||
|
||||
echo ""
|
||||
echo "bruh, still low on space, yeeting old backups"
|
||||
echo ""
|
||||
|
||||
# tail -n+2 ensure we keep at least one backup.
|
||||
for file in $(ls -t1 '${cfg.dump.backupDir}' | sort --reverse | tail -n+2); do
|
||||
echo "> Chose $file"
|
||||
echo "> Do you really want to release this pokemon? [Y/n] Y"
|
||||
rm "$file"
|
||||
echo "> ..."
|
||||
echo "> The pokemon was released back into the wild"
|
||||
echo ""
|
||||
|
||||
USED=$(df --output=pcent '${cacheDir}' | grep '[0-9]' | tr -d '%')
|
||||
if [[ $USED -lt ${toString percentageLimit} ]]; then exit 0; fi
|
||||
done
|
||||
|
||||
echo "No way, we're still out of space? Not my problem anymore"
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user