dotfiles/home/Vault.nix

79 lines
2.4 KiB
Nix
Raw Normal View History

2024-06-10 15:07:36 +02:00
{ inputs, config, pkgs, ... }:
let
scripts = {
disk_check = {
when = "*-*-* *:00:00";
script = toString (pkgs.writeShellScript "script" ''
REPORT_EMAIL=email@thomasave.be
ZPOOL_STATUS=$(zpool status -x)
if [ "$ZPOOL_STATUS" = "all pools are healthy" ] || [ "$ZPOOL_STATUS" = "no pools available" ]
then
printf 0 > /var/db/zpool.status
else
if [ "$(cat /var/db/zpool.status)" -eq 0 ]
then
zpool status | mail -s "ZPOOL NOT HEALTHY" $REPORT_EMAIL
printf 1 > /var/db/zpool.status
fi
fi
'');
};
2024-06-10 15:21:53 +02:00
restic_etienne = {
when = "*-*-* 01:00:00";
script = toString (pkgs.writeShellScript "script" ''
2024-06-13 11:53:29 +02:00
/Backup/Restic/Etienne/run.sh
${pkgs.curl}/bin/curl https://uptime.thomasave.be/api/push/zGPrOi0NsJ
2024-06-10 15:21:53 +02:00
'');
};
restic_magda_and_etienne = {
when = "*-*-* 03:00:00";
script = toString (pkgs.writeShellScript "script" ''
2024-06-13 11:53:29 +02:00
/Backup/Restic/Magda\ and\ Etienne/run.sh
${pkgs.curl}/bin/curl https://uptime.thomasave.be/api/push/yvBuDgduDd
2024-06-10 15:21:53 +02:00
'');
};
restic_backblaze = {
when = "*-*-* 02:00:00";
script = toString (pkgs.writeShellScript "script" ''
2024-06-13 11:53:29 +02:00
/Backup/Restic/BackBlaze/run.sh
${pkgs.curl}/bin/curl https://uptime.thomasave.be/api/push/LVruVYTwTn
2024-06-10 15:21:53 +02:00
'');
};
mail_sync = {
when = "*-*-* 04:00:00";
script = toString (pkgs.writeShellScript "script" ''
2024-06-13 11:53:29 +02:00
cd /home/server/Containers/Mails && docker compose up sync-etienne sync-magda
${pkgs.curl}/bin/curl https://uptime.thomasave.be/api/push/eEIPVGyrAx
2024-06-10 15:21:53 +02:00
'');
};
2024-06-10 15:07:36 +02:00
};
2024-06-13 11:53:29 +02:00
in
{
2024-06-10 15:07:36 +02:00
home.username = "server";
home.homeDirectory = "/home/server";
nix = {
package = pkgs.nix;
settings.use-xdg-base-directories = true;
};
xdg.enable = true;
2024-06-10 16:31:23 +02:00
imports = [
2024-06-13 12:25:16 +02:00
(import ./utils/common.nix { inherit inputs config pkgs; })
2024-06-13 11:53:29 +02:00
(import ./utils/services.nix { inherit pkgs; scripts = scripts; })
./ssh
2024-06-10 16:31:23 +02:00
];
2024-06-10 15:07:36 +02:00
programs.ssh.matchBlocks."*".identityFile = "/home/server/.secrets/SSH/Vault/id_ed25519";
home.sessionVariables = {
NIX_PATH = "${config.xdg.stateHome}/nix/profiles/channels/";
LANG = "en_US.UTF-8";
XDG_RUNTIME_DIR = "/run/user/$(id -u)";
};
2024-06-14 20:54:59 +02:00
programs.zsh.initExtra = ''
LOCAL_SEARCH_DIRS=(~/.dotfiles/ ~/Storage/Thomas/ ~/Storage/Etienne/ ~/Storage/Magda\ and\ Etienne/ ~/Containers/)
REMOTE_SEARCH_DIRS=()
'';
2024-06-10 15:07:36 +02:00
}