Compare commits
9 Commits
88e73a3ea8
...
272ae1cd55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
272ae1cd55 | ||
|
|
c4052ec34d | ||
|
|
f4f80ffbde | ||
|
|
2de110149f | ||
|
|
b0ab87bbab | ||
|
|
edde9bd52b | ||
|
|
bf56cc88bf | ||
|
|
393d7f4fc4 | ||
|
|
2ecb4ce65a |
Binary file not shown.
58
home-modules/calendar-campuszeit-fix.nix
Normal file
58
home-modules/calendar-campuszeit-fix.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{ pkgs, user, ... }:
|
||||
{
|
||||
home.packages = let
|
||||
u = pkgs.writers.writePython3Bin "nx_fix_campuszeit_python" {
|
||||
flakeIgnore = [ "E302" "E305" "E226" "E501" ];
|
||||
} /* python */ ''
|
||||
import os
|
||||
import sys
|
||||
|
||||
def replace_campus_timezone(directory):
|
||||
if not os.path.isdir(directory):
|
||||
print(f"Error: {directory} is not a valid directory.")
|
||||
return
|
||||
|
||||
for filename in os.listdir(directory):
|
||||
filepath = os.path.join(directory, filename)
|
||||
if not os.path.isfile(filepath):
|
||||
continue
|
||||
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
if 'TZID:Europe/Berlin' in content or 'TZID="Europe/Berlin"' in content:
|
||||
# Remove VTIMEZONE block for CampusNetZeit (optional depending on needs)
|
||||
# Use a regex if multiple VTIMEZONE blocks may exist
|
||||
start_idx = content.find('BEGIN:VTIMEZONE')
|
||||
end_idx = content.find('END:VTIMEZONE', start_idx)
|
||||
if start_idx != -1 and end_idx != -1:
|
||||
content = content[:start_idx] + content[end_idx + len('END:VTIMEZONE\n'):]
|
||||
|
||||
# Replace all TZID references
|
||||
content = content.replace('TZID:Europe/Berlin', 'TZID:Europe/Berlin')
|
||||
content = content.replace('TZID="Europe/Berlin"', 'TZID="Europe/Berlin"')
|
||||
|
||||
with open(filepath, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"Updated time zone in: {filename}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python replace_timezone.py <directory>")
|
||||
else:
|
||||
replace_campus_timezone(sys.argv[1])
|
||||
'';
|
||||
in [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "nx_fix_campuszeit";
|
||||
text = /*bash*/ ''
|
||||
echo CHANGING OWNERSHIP OF "$(realpath "$1")" RECURSIVELY
|
||||
read -r -p "Continue?"
|
||||
sudo chown -R ${user} "$1"
|
||||
${u}/bin/nx_fix_campuszeit_python "$1"
|
||||
sudo chown -R radicale "$1"
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
{ pkgs, hyper, ... }:
|
||||
# lib.mkIf (host == "NxNORTH" || host == "NxACE")
|
||||
pkgs.lib.mkIf (hyper.host == "NxNORTH")
|
||||
{
|
||||
home = {
|
||||
@@ -9,7 +8,7 @@ pkgs.lib.mkIf (hyper.host == "NxNORTH")
|
||||
|
||||
# heroic
|
||||
|
||||
mindustry-wayland
|
||||
# mindustry-wayland
|
||||
]) ++ [ pkgs.heroic ];
|
||||
sessionVariables = {
|
||||
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d";
|
||||
|
||||
@@ -118,7 +118,7 @@ in
|
||||
efiSupport = true;
|
||||
};
|
||||
};
|
||||
kernelPackages = pkgs.linuxPackages; # default kernel of pkgs
|
||||
kernelPackages = pkgs.linuxPackages_6_12;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,11 +78,14 @@ def modify_event(event):
|
||||
latest_goal = goal
|
||||
latest_week = week
|
||||
|
||||
new_description = [event.description.split("\n")[0] or "::"]
|
||||
try:
|
||||
new_description = [event.description.split("\n")[0]]
|
||||
except AttributeError:
|
||||
new_description = ["::"]
|
||||
new_description.append("")
|
||||
new_description.append(f"Netto: {money_made[0]:.0f},{int(money_made[1] * 10):02d}€")
|
||||
new_description.append(f"This weeks porgress: ({fraction_to_unicode(progress)}/{fraction_to_unicode(goal)})")
|
||||
new_description.append(f"This weeks deficit: {fraction_to_unicode(deficit)}")
|
||||
new_description.append(f"You're {fraction_to_unicode(abs(deficit))}h in the {'plus' if deficit < 0 else 'minus'} this week.")
|
||||
|
||||
event.description = "\n".join(new_description)
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{ pkgs, hyper, ... }:
|
||||
# lib.mkIf (host == "NxNORTH" || host == "NxACE")
|
||||
pkgs.lib.mkIf (hyper.host == "NxNORTH")
|
||||
pkgs.lib.mkIf (hyper.host == "NxNORTH" || hyper.host == "NxACE")
|
||||
{
|
||||
programs = {
|
||||
steam = {
|
||||
|
||||
@@ -41,6 +41,7 @@ let dns-user = "cloudflare"; in
|
||||
sub6 = "b8082b7afe9e80971fc9f9dda16ec284";
|
||||
ssh = "c0f14f17f32d6595c202f041dd836eb3";
|
||||
ssh6 = "f1ecb2d9d0522d4eec06437688ca76da";
|
||||
dev = "80e76834acc9243696d9763759b22147";
|
||||
};
|
||||
passord-file-path = config.sops.secrets."nx2site/cloudflare/global-api-key".path;
|
||||
in pkgs.writers.writePython3Bin "dyn_dns" {
|
||||
@@ -84,13 +85,14 @@ def main():
|
||||
|
||||
# Perform DNS updates
|
||||
# https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-update-dns-record
|
||||
print(f"${hyper.domain}: {update_record(record_id="${record_id.base}", record_name="${hyper.domain}", ip=my_ip, type="A", proxied=True, pw=pw).status_code}")
|
||||
print(f"*.${hyper.domain}: {update_record(record_id="${record_id.sub}", record_name="*.${hyper.domain}", ip=my_ip, type="A", proxied=True, pw=pw).status_code}")
|
||||
print(f"ssh.${hyper.domain}: {update_record(record_id="${record_id.ssh}", record_name="ssh.${hyper.domain}", ip=my_ip, type="A", proxied=False, pw=pw).status_code}")
|
||||
print(f"${hyper.domain}: {update_record(record_id="${record_id.base}", record_name="${hyper.domain}", ip=my_ip, type="A", proxied=True, pw=pw).status_code}", end=", ")
|
||||
print(f"*.${hyper.domain}: {update_record(record_id="${record_id.sub}", record_name="*.${hyper.domain}", ip=my_ip, type="A", proxied=True, pw=pw).status_code}", end=", ")
|
||||
print(f"ssh.${hyper.domain}: {update_record(record_id="${record_id.ssh}", record_name="ssh.${hyper.domain}", ip=my_ip, type="A", proxied=False, pw=pw).status_code}", end=", ")
|
||||
print(f"dev.${hyper.domain}: {update_record(record_id="${record_id.dev}", record_name="dev.${hyper.domain}", ip=my_ip, type="A", proxied=False, pw=pw).status_code}", end=", ")
|
||||
|
||||
print(f"${hyper.domain}: {update_record(record_id="${record_id.base6}", record_name="${hyper.domain}", ip=my_ip6, type="AAAA", proxied=True, pw=pw).status_code}")
|
||||
print(f"*.${hyper.domain}: {update_record(record_id="${record_id.sub6}", record_name="*.${hyper.domain}", ip=my_ip6, type="AAAA", proxied=True, pw=pw).status_code}")
|
||||
print(f"ssh.${hyper.domain}: {update_record(record_id="${record_id.ssh6}", record_name="ssh.${hyper.domain}", ip=my_ip6, type="AAAA", proxied=False, pw=pw).status_code}")
|
||||
print(f"${hyper.domain}: {update_record(record_id="${record_id.base6}", record_name="${hyper.domain}", ip=my_ip6, type="AAAA", proxied=True, pw=pw).status_code}", end=", ")
|
||||
print(f"*.${hyper.domain}: {update_record(record_id="${record_id.sub6}", record_name="*.${hyper.domain}", ip=my_ip6, type="AAAA", proxied=True, pw=pw).status_code}", end=", ")
|
||||
print(f"ssh.${hyper.domain}: {update_record(record_id="${record_id.ssh6}", record_name="ssh.${hyper.domain}", ip=my_ip6, type="AAAA", proxied=False, pw=pw).status_code}", end="")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -93,8 +93,8 @@ let git-user = "git"; in
|
||||
domain = "git.${hyper.domain}";
|
||||
owner = "nx2";
|
||||
repo = "Gitea-Pitch-Black";
|
||||
rev = "0.1.0";
|
||||
hash = "sha256-pU4YhgcPOT3PTcmBTjNE3FcyJgl39JGP41ckhRUKN7Y=";
|
||||
rev = "0.1.1";
|
||||
hash = "sha256-40LzF/DobikNzrFjCSzvCT0g4x/CKS2JUWTf/CyJoJs=";
|
||||
};
|
||||
in {
|
||||
"gitea-theme" = /* bash */ ''
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
};
|
||||
certs = {
|
||||
"${hyper.domain}" = {
|
||||
extraDomainNames = builtins.map (subd: "${subd}.${hyper.domain}") [ "sync" "dev" ];
|
||||
extraDomainNames = builtins.map (subd: "${subd}.${hyper.domain}") [ "sync" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -136,7 +136,7 @@
|
||||
listen = dl;
|
||||
locations = { "/" = { proxyPass = "http://127.0.0.1:8441"; }; };
|
||||
};
|
||||
"dav.${hyper.domain}" = lib.mkIf config.services.radicale.enable (vh // {
|
||||
"dav.${hyper.domain}" = pkgs.lib.mkIf config.services.radicale.enable (vh // {
|
||||
listen = dl;
|
||||
locations = { "/" = { proxyPass = "http://127.0.0.1:5232"; }; };
|
||||
});
|
||||
@@ -150,16 +150,22 @@
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
"pnx.${hyper.domain}" = vh // {
|
||||
listen = dl;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8040";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
"wip.${hyper.domain}" = vh // {
|
||||
listen = dl;
|
||||
};
|
||||
"dev.${hyper.domain}" = vh // {
|
||||
listen = dl ++ [
|
||||
# { addr = "0.0.0.0"; port = 8000; ssl = true; }
|
||||
# { addr = "[::0]"; port = 8000; ssl = true; }
|
||||
];
|
||||
root = "/var/lib/hugo/nx2site/public";
|
||||
# locations."/" = {
|
||||
# proxyPass = "http://127.0.0.1:8000";
|
||||
# proxyWebsockets = true;
|
||||
# };
|
||||
listen = dl;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8080";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
# is done atomatically
|
||||
# "cal.${hyper.domain}" = vh // {
|
||||
|
||||
Reference in New Issue
Block a user