mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 20:50:15 +00:00
backups and fish functions
This commit is contained in:
@ -1,5 +0,0 @@
|
||||
if count $argv >/dev/null
|
||||
curl ipinfo.io/$argv
|
||||
else
|
||||
curl checkip.amazonaws.com
|
||||
end
|
@ -1,8 +0,0 @@
|
||||
if test -n "$filename"
|
||||
vim $NOTES_PATH/$filename.md
|
||||
else
|
||||
set file (ls $NOTES_PATH | fzf)
|
||||
if [ $status -eq 0 ]
|
||||
vim $NOTES_PATH/$file
|
||||
end
|
||||
end
|
@ -17,5 +17,5 @@ set vimfile ( \
|
||||
)
|
||||
and set line_number (echo $vimfile | tr -d '\r' | cut -d':' -f2)
|
||||
and set vimfile (echo $vimfile | tr -d '\r' | cut -d':' -f1)
|
||||
and commandline -r "vim +$line_number $vimfile"
|
||||
and commandline -r "vim +$line_number \"$vimfile\""
|
||||
and commandline -f execute
|
||||
|
@ -1,7 +0,0 @@
|
||||
set current_dir $PWD
|
||||
cd $NOTES_PATH
|
||||
git pull
|
||||
git add -A
|
||||
git commit -m autosync
|
||||
git push
|
||||
cd $current_dir
|
@ -1,103 +0,0 @@
|
||||
# This is my setup for backing up SQlite databases and other systems to S3 or
|
||||
# S3-equivalent services (like Backblaze B2).
|
||||
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
backup.s3 = {
|
||||
endpoint = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 endpoint for backups";
|
||||
default = null;
|
||||
};
|
||||
bucket = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 bucket for backups";
|
||||
default = null;
|
||||
};
|
||||
accessKeyId = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 access key ID for backups";
|
||||
default = null;
|
||||
};
|
||||
resticBucket = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 bucket for restic backups";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.backup.s3.endpoint != null) {
|
||||
|
||||
users.groups.backup = { };
|
||||
|
||||
secrets.backup = {
|
||||
source = ../../../private/backup.age;
|
||||
dest = "${config.secretsDirectory}/backup";
|
||||
group = "backup";
|
||||
permissions = "0440";
|
||||
};
|
||||
|
||||
users.users.litestream.extraGroups = [ "backup" ];
|
||||
|
||||
services.litestream = {
|
||||
enable = true;
|
||||
environmentFile = config.secrets.backup.dest;
|
||||
settings = { };
|
||||
};
|
||||
|
||||
# Broken on 2024-08-23
|
||||
# https://github.com/NixOS/nixpkgs/commit/0875d0ce1c778f344cd2377a5337a45385d6ffa0
|
||||
insecurePackages = [ "litestream-0.3.13" ];
|
||||
|
||||
# Wait for secret to exist
|
||||
systemd.services.litestream = {
|
||||
after = [ "backup-secret.service" ];
|
||||
requires = [ "backup-secret.service" ];
|
||||
environment.AWS_ACCESS_KEY_ID = config.backup.s3.accessKeyId;
|
||||
};
|
||||
|
||||
# # Backup library to object storage
|
||||
# services.restic.backups.calibre = {
|
||||
# user = "calibre-web";
|
||||
# repository =
|
||||
# "s3://${config.backup.s3.endpoint}/${config.backup.s3.bucket}/calibre";
|
||||
# paths = [
|
||||
# "/var/books"
|
||||
# "/var/lib/calibre-web/app.db"
|
||||
# "/var/lib/calibre-web/gdrive.db"
|
||||
# ];
|
||||
# initialize = true;
|
||||
# timerConfig = { OnCalendar = "00:05:00"; };
|
||||
# environmentFile = backup.s3File;
|
||||
# };
|
||||
|
||||
secrets.s3-glacier = {
|
||||
source = ../../../private/s3-glacier.age;
|
||||
dest = "${config.secretsDirectory}/s3-glacier";
|
||||
};
|
||||
secrets.restic = {
|
||||
source = ../../../private/restic.age;
|
||||
dest = "${config.secretsDirectory}/restic";
|
||||
};
|
||||
|
||||
services.restic.backups = lib.mkIf (config.backup.s3.resticBucket != null) {
|
||||
default = {
|
||||
repository = "s3:s3.us-east-1.amazonaws.com/${config.backup.s3.resticBucket}/restic";
|
||||
paths = [ ];
|
||||
environmentFile = config.secrets.s3-glacier.dest;
|
||||
passwordFile = config.secrets.restic.dest;
|
||||
pruneOpts = [
|
||||
"--keep-daily 14"
|
||||
"--keep-weekly 6"
|
||||
"--keep-monthly 12"
|
||||
"--keep-yearly 100"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
# This file imports all the other files in this directory for use as modules in
|
||||
# my config.
|
||||
|
||||
{ ... }:
|
||||
{
|
||||
|
||||
imports = [
|
||||
./actualbudget.nix
|
||||
./audiobookshelf.nix
|
||||
./arr.nix
|
||||
./backups.nix
|
||||
./bind.nix
|
||||
./caddy.nix
|
||||
./calibre.nix
|
||||
./cloudflare-tunnel.nix
|
||||
./cloudflare.nix
|
||||
./filebrowser.nix
|
||||
./identity.nix
|
||||
./immich.nix
|
||||
./irc.nix
|
||||
./gitea-runner.nix
|
||||
./gitea.nix
|
||||
./gnupg.nix
|
||||
./grafana.nix
|
||||
./honeypot.nix
|
||||
./influxdb2.nix
|
||||
./jellyfin.nix
|
||||
./keybase.nix
|
||||
./mullvad.nix
|
||||
./n8n.nix
|
||||
./netdata.nix
|
||||
./nextcloud.nix
|
||||
./ntfy.nix
|
||||
./paperless.nix
|
||||
./postgresql.nix
|
||||
./prometheus.nix
|
||||
./samba.nix
|
||||
./secrets.nix
|
||||
./sshd.nix
|
||||
./transmission.nix
|
||||
./uptime-kuma.nix
|
||||
./vaultwarden.nix
|
||||
./victoriametrics.nix
|
||||
./wireguard.nix
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user