From a816f12d4c25a4ad8321fe546082cfe9151f520a Mon Sep 17 00:00:00 2001 From: alejandro-angulo Date: Tue, 17 Sep 2024 17:45:41 -0700 Subject: [PATCH] Removed syncoid module --- modules/nixos/services/syncoid/default.nix | 91 ---------------------- systems/x86_64-linux/gospel/default.nix | 10 --- systems/x86_64-linux/node/default.nix | 7 -- 3 files changed, 108 deletions(-) delete mode 100644 modules/nixos/services/syncoid/default.nix diff --git a/modules/nixos/services/syncoid/default.nix b/modules/nixos/services/syncoid/default.nix deleted file mode 100644 index 01052ff..0000000 --- a/modules/nixos/services/syncoid/default.nix +++ /dev/null @@ -1,91 +0,0 @@ -{ - options, - config, - pkgs, - lib, - ... -}: let - inherit (lib) mkIf; - - cfg = config.aa.services.syncoid; -in { - options.aa.services.syncoid = with lib; { - enable = mkEnableOption "syncoid (ZFS snap replication)"; - commands = mkOption { - type = types.attrs; - default = {}; - description = "Commands to pass directly to syncoid, see `services.syncoid.commands`"; - }; - remoteTargetUser = mkOption { - type = types.str; - default = ""; - description = "The user to use on the target machine."; - }; - remoteTargetDatasets = mkOption { - type = types.listOf types.str; - default = []; - description = "Datasets to be used as a remote target (e.g. a NAS's backups dataset)"; - }; - remoteTargetPublicKeys = mkOption { - type = types.listOf types.str; - default = []; - description = "SSH public keys that the syncoid service's user should trust"; - }; - }; - - config = mkIf cfg.enable { - services.syncoid = { - enable = true; - localSourceAllow = - options.services.syncoid.localSourceAllow.default - ++ [ - "mount" - ]; - localTargetAllow = - options.services.syncoid.localTargetAllow.default - ++ [ - "destroy" - ]; - commands = lib.mkAliasDefinitions options.aa.services.syncoid.commands; - }; - - environment.systemPackages = mkIf (cfg.remoteTargetUser != "") (with pkgs; [ - lzop - mbuffer - ]); - - users = mkIf (cfg.remoteTargetUser != "") { - users."${cfg.remoteTargetUser}" = { - shell = pkgs.bashInteractive; - group = cfg.remoteTargetUser; - isSystemUser = true; - home = "/var/lib/${cfg.remoteTargetUser}"; - createHome = true; - openssh.authorizedKeys.keys = cfg.remoteTargetPublicKeys; - }; - groups."${cfg.remoteTargetUser}" = {}; - }; - - systemd.services.setup-syncoid-remote = { - description = "Permission setup for syncoid remote targets"; - documentation = ["https://github.com/jimsalterjrs/sanoid/wiki/Syncoid#running-without-root"]; - wantedBy = ["multi-user.target"]; - path = [pkgs.zfs]; - - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = "yes"; - }; - - script = '' - DATASETS=(${toString cfg.remoteTargetDatasets}) - for dataset in "''${DATASETS[@]}"; do - zfs allow \ - -u ${cfg.remoteTargetUser} \ - compression,mountpoint,create,mount,receive,rollback,destroy \ - "$dataset" - done - ''; - }; - }; -} diff --git a/systems/x86_64-linux/gospel/default.nix b/systems/x86_64-linux/gospel/default.nix index edf0353..02c35c3 100644 --- a/systems/x86_64-linux/gospel/default.nix +++ b/systems/x86_64-linux/gospel/default.nix @@ -44,16 +44,6 @@ configureClientRouting = true; configureServerRouting = true; }; - services.syncoid = { - enable = true; - commands = { - "rpool" = { - target = "backups@192.168.113.13:tank/backups/gospel/rpool"; - recursive = true; - sshKey = "/var/lib/syncoid/.ssh/id_ed25519"; - }; - }; - }; services.prometheus.enable = true; services.promtail.enable = true; services.hydra = { diff --git a/systems/x86_64-linux/node/default.nix b/systems/x86_64-linux/node/default.nix index 7bec2f1..e52b4ee 100644 --- a/systems/x86_64-linux/node/default.nix +++ b/systems/x86_64-linux/node/default.nix @@ -42,13 +42,6 @@ }; services.loki.enable = true; services.promtail.enable = true; - services.syncoid = { - # sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel - enable = true; - remoteTargetUser = "backups"; - remoteTargetDatasets = ["tank/backups"]; - remoteTargetPublicKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAhA+9O2OBMDH1Xnj6isu36df5TOdZG8aEA4JpN2K60e syncoid@gospel"]; - }; services.teslamate = { enable = true; database = {