generalize common -> oizys and add backups option

This commit is contained in:
Daylin Morgan 2024-03-19 09:49:43 -05:00
parent 9f8a1692b5
commit cec9ce730f
Signed by: daylin
GPG key ID: 950D13E9719334AD
5 changed files with 59 additions and 48 deletions

View file

@ -16,12 +16,11 @@ in {
"python" "python"
]; ];
docker = enabled; docker = enabled;
backups = enabled;
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
rclone (writeShellScriptBin "gitea" ''
(pkgs.writeShellScriptBin "gitea" ''
ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@" ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
'') '')
]; ];

View file

@ -4,34 +4,31 @@
lib, lib,
... ...
}: let }: let
inherit (lib) enableAttrs; inherit (lib) enabled;
in { in {
imports = with self.nixosModules; [ imports = with self.nixosModules; [
restic restic
]; ];
oizys = oizys = {
{ desktop = enabled;
languages = [ chrome = enabled;
"misc" docker = enabled;
"python" nix-ld = enabled;
"nim" vbox = enabled;
"tex" vpn = enabled;
"node" backups = enabled;
]; languages = [
} "misc"
// enableAttrs [ "python"
"chrome" "nim"
"desktop" "tex"
"docker" "node"
"nix-ld"
"vbox"
"vpn"
]; ];
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
zk zk
rclone
quarto quarto
]; ];

View file

@ -30,7 +30,7 @@ in rec {
system = "x86_64-linux"; system = "x86_64-linux";
modules = modules =
[ [
../modules/common.nix ../modules/oizys.nix
../overlays ../overlays
] ]
++ filter ++ filter

View file

@ -2,7 +2,9 @@
lib, lib,
self, self,
... ...
}: { }: let
inherit (lib) mkEnableOption;
in {
imports = with self.nixosModules; [ imports = with self.nixosModules; [
users users
nix nix
@ -33,5 +35,5 @@
nix-ld nix-ld
]; ];
options.oizys.desktop.enable = lib.mkEnableOption "is desktop"; options.oizys.desktop.enable = mkEnableOption "is desktop";
} }

View file

@ -1,27 +1,40 @@
{...}: { {
services.restic.backups.gdrive = { config,
# BUG: if .conda/environments.txt doesn't exist then this won't work pkgs,
# workaround for now `mkdir ~/.conda && touch ~/.conda/environments.txt` lib,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.oizys.backups;
in {
options.oizys.backups.enable = mkEnableOption "enable restic/rclone backups";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [rclone];
extraBackupArgs = [ services.restic.backups.gdrive = {
"--exclude-file /home/daylin/.config/restic/excludes.txt" # BUG: if .conda/environments.txt doesn't exist then this won't work
"--exclude-file /home/daylin/.conda/environments.txt" # workaround for now `mkdir ~/.conda && touch ~/.conda/environments.txt`
"--verbose"
"--one-file-system" extraBackupArgs = [
"--tag systemd.timer" "--exclude-file /home/daylin/.config/restic/excludes.txt"
]; "--exclude-file /home/daylin/.conda/environments.txt"
pruneOpts = [ "--verbose"
"--verbose" "--one-file-system"
"--tag systemd.timer" "--tag systemd.timer"
"--keep-daily 7" ];
"--keep-weekly 4" pruneOpts = [
"--keep-monthly 12" "--verbose"
"--keep-yearly 3" "--tag systemd.timer"
]; "--keep-daily 7"
timerConfig = { "--keep-weekly 4"
OnCalendar = "00:05"; "--keep-monthly 12"
Persistent = true; "--keep-yearly 3"
RandomizedDelaySec = "5h"; ];
timerConfig = {
OnCalendar = "00:05";
Persistent = true;
RandomizedDelaySec = "5h";
};
}; };
}; };
} }