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"
];
docker = enabled;
backups = enabled;
};
environment.systemPackages = with pkgs; [
rclone
(pkgs.writeShellScriptBin "gitea" ''
(writeShellScriptBin "gitea" ''
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,
...
}: let
inherit (lib) enableAttrs;
inherit (lib) enabled;
in {
imports = with self.nixosModules; [
restic
];
oizys =
{
languages = [
"misc"
"python"
"nim"
"tex"
"node"
];
}
// enableAttrs [
"chrome"
"desktop"
"docker"
"nix-ld"
"vbox"
"vpn"
oizys = {
desktop = enabled;
chrome = enabled;
docker = enabled;
nix-ld = enabled;
vbox = enabled;
vpn = enabled;
backups = enabled;
languages = [
"misc"
"python"
"nim"
"tex"
"node"
];
};
environment.systemPackages = with pkgs; [
zk
rclone
quarto
];

View file

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

View file

@ -2,7 +2,9 @@
lib,
self,
...
}: {
}: let
inherit (lib) mkEnableOption;
in {
imports = with self.nixosModules; [
users
nix
@ -33,5 +35,5 @@
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 = {
# BUG: if .conda/environments.txt doesn't exist then this won't work
# workaround for now `mkdir ~/.conda && touch ~/.conda/environments.txt`
{
config,
pkgs,
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 = [
"--exclude-file /home/daylin/.config/restic/excludes.txt"
"--exclude-file /home/daylin/.conda/environments.txt"
"--verbose"
"--one-file-system"
"--tag systemd.timer"
];
pruneOpts = [
"--verbose"
"--tag systemd.timer"
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 12"
"--keep-yearly 3"
];
timerConfig = {
OnCalendar = "00:05";
Persistent = true;
RandomizedDelaySec = "5h";
services.restic.backups.gdrive = {
# BUG: if .conda/environments.txt doesn't exist then this won't work
# workaround for now `mkdir ~/.conda && touch ~/.conda/environments.txt`
extraBackupArgs = [
"--exclude-file /home/daylin/.config/restic/excludes.txt"
"--exclude-file /home/daylin/.conda/environments.txt"
"--verbose"
"--one-file-system"
"--tag systemd.timer"
];
pruneOpts = [
"--verbose"
"--tag systemd.timer"
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 12"
"--keep-yearly 3"
];
timerConfig = {
OnCalendar = "00:05";
Persistent = true;
RandomizedDelaySec = "5h";
};
};
};
}