Merge branch 'master' of ssh://ssh.nx2.site:50022/nx2/dotfiles

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2025-01-30 13:42:56 +01:00
78 changed files with 569 additions and 179 deletions

View File

View File

View File

View File

0
home-modules/bash.nix Executable file → Normal file
View File

0
home-modules/bitwarden.nix Executable file → Normal file
View File

View File

@@ -35,7 +35,7 @@
}
{
name = "LEC";
url = "https://zlypher.github.io/lol-events/cal/league-of-legends-lec.ical";
url = "https://${domain}/lec.ics";
color = "#A87000";
read-only = true;
type = "ics";

0
home-modules/chatterino.nix Executable file → Normal file
View File

0
home-modules/direnv.nix Executable file → Normal file
View File

0
home-modules/discord.nix Executable file → Normal file
View File

0
home-modules/email.nix Executable file → Normal file
View File

0
home-modules/fish.nix Executable file → Normal file
View File

0
home-modules/games.nix Executable file → Normal file
View File

0
home-modules/gestures.nix Executable file → Normal file
View File

0
home-modules/gimp.nix Executable file → Normal file
View File

0
home-modules/git.nix Executable file → Normal file
View File

0
home-modules/gtk.nix Executable file → Normal file
View File

0
home-modules/hyprland-autoname-workspaces.nix Executable file → Normal file
View File

0
home-modules/hyprland.nix Executable file → Normal file
View File

0
home-modules/kitty.nix Executable file → Normal file
View File

0
home-modules/latex.nix Executable file → Normal file
View File

0
home-modules/mako.nix Executable file → Normal file
View File

0
home-modules/nh.nix Executable file → Normal file
View File

0
home-modules/nx-gcal-event.nix Executable file → Normal file
View File

View File

@@ -0,0 +1,67 @@
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellApplication {
name = "nx_backup";
runtimeInputs = [ ];
text = let
web-root = "/var/nginx/webroot";
gitea-backup = "/var/backup/gitea";
postgres-backup = "/var/backup/postgresql";
in /* bash */ ''
DIRECTORIES=(
"${web-root}"
"${gitea-backup}"
"${postgres-backup}"
)
NOW=$(date +%Y_%m_%d-%H_%M)
TEMP_BAK_DIR=$(mktemp -d)
TEMP_WORKING_DIR=$(mktemp -d)
ZIP_NAME="nx2site-backup-''${NOW}.zip"
ZIP_FILE="$TEMP_WORKING_DIR/$ZIP_NAME"
ENCRYPTED_NAME="''${ZIP_NAME}.asc"
ENCRYPTED_FILE="$TEMP_WORKING_DIR/$ENCRYPTED_NAME"
DESTINATION="/vault/$ENCRYPTED_NAME"
WEBROOT="${web-root}"
echo "Fixing Permissions of Gitea dump"
sudo chmod -R g+r "${gitea-backup}"
echo "Fixing Permissions of Postgres dump"
sudo chmod -R g+r "${postgres-backup}"
sudo chmod g+x "${postgres-backup}"
echo "Fixing Ownership of Postgres dump"
sudo chown -R postgres:postgres "${postgres-backup}"
echo "Copying files to backup to tempoary directory $TEMP_BAK_DIR ..."
for DIR in "''${DIRECTORIES[@]}"; do
rsync -aR "$DIR" "$TEMP_BAK_DIR"
done
# Create the zip file
echo "Adding files to $ZIP_NAME ..."
zip -qr "$ZIP_FILE" "$TEMP_BAK_DIR"
# Encrypt the zip file using GPG
echo "Encryping file with gpg"
gpg -e -r gpg@nx2.site -o "$ENCRYPTED_FILE" "$ZIP_FILE"
echo "Moving file to Destination $DESTINATION"
mv "$ENCRYPTED_FILE" "$DESTINATION"
echo "Updating latest-bakup path in $WEBROOT"
echo "$DESTINATION" > "$WEBROOT/latest-backup"
echo "Cleaning up tempoary files and directories"
rm -rf "$TEMP_BAK_DIR" "$TEMP_WORKING_DIR" "$ZIP_FILE"
echo "Backup and encryption complete: $DESTINATION"
echo "Space remaining:"
df -h | head -n 1
df -h | grep -P "^/dev.+? "
'';
})
];
}

0
home-modules/office.nix Executable file → Normal file
View File

0
home-modules/pnx.nix Executable file → Normal file
View File

0
home-modules/programming/python.nix Executable file → Normal file
View File

0
home-modules/qt.nix Executable file → Normal file
View File

0
home-modules/rofi.nix Executable file → Normal file
View File

0
home-modules/ssh.nix Executable file → Normal file
View File

0
home-modules/starship.nix Executable file → Normal file
View File

0
home-modules/tts.nix Executable file → Normal file
View File

0
home-modules/virt-manager.nix Executable file → Normal file
View File

0
home-modules/vscode.nix Executable file → Normal file
View File

0
home-modules/waybar.nix Executable file → Normal file
View File

0
home-modules/wlogout.nix Executable file → Normal file
View File

0
home-modules/yazi.nix Executable file → Normal file
View File

0
home-modules/zoxide.nix Executable file → Normal file
View File