diff --git a/hosts/algiz/default.nix b/hosts/algiz/default.nix index 85e4887..6ac33d0 100644 --- a/hosts/algiz/default.nix +++ b/hosts/algiz/default.nix @@ -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 $@" '') ]; diff --git a/hosts/othalan/default.nix b/hosts/othalan/default.nix index 4b74df6..94f12fd 100644 --- a/hosts/othalan/default.nix +++ b/hosts/othalan/default.nix @@ -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 ]; diff --git a/lib/default.nix b/lib/default.nix index 0d13ca5..944944f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -30,7 +30,7 @@ in rec { system = "x86_64-linux"; modules = [ - ../modules/common.nix + ../modules/oizys.nix ../overlays ] ++ filter diff --git a/modules/common.nix b/modules/oizys.nix similarity index 72% rename from modules/common.nix rename to modules/oizys.nix index dc22a0c..a15268d 100644 --- a/modules/common.nix +++ b/modules/oizys.nix @@ -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"; } diff --git a/modules/storage/restic.nix b/modules/storage/restic.nix index 9a856ff..1037f7e 100644 --- a/modules/storage/restic.nix +++ b/modules/storage/restic.nix @@ -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"; + }; }; }; }