From 9d0fd9fe5a9e61a03f43ba8affb5c764ecd3f08b Mon Sep 17 00:00:00 2001 From: genofire Date: Wed, 13 Oct 2021 17:32:28 +0200 Subject: [PATCH] nixos: add zrepl --- nixos/default-hardware.nix | 34 ++++++++++++++++++++++++++++++++++ nixos/default.nix | 1 + 2 files changed, 35 insertions(+) diff --git a/nixos/default-hardware.nix b/nixos/default-hardware.nix index 8c5acdb..527d858 100644 --- a/nixos/default-hardware.nix +++ b/nixos/default-hardware.nix @@ -10,6 +10,40 @@ boot.supportedFilesystems = [ "zfs" ]; #boot.kernelParams = [ "nohibernate" ]; services.zfs.autoScrub.enable = true; + services.zrepl = { + enable = true; + settings = { + global.monitoring = [{ + type = "prometheus"; + listen = ":9091"; + }]; + jobs = [{ + name = "fireStore"; + type = "source"; + serve = { + type = "stdinserver"; + client_identities = [ "fireStore" ]; + }; + snapshotting = { + type = "periodic"; + interval = "24h"; + prefix = "zrepl_fireStore_"; + }; + send.encrypted = false; + filesystems = { + "zroot/ROOT<" = true; + "zroot/ROOT" = false; + "zroot/local<" = false; + "zroot/local/nix" = false; + "zroot/data<" = true; + "zroot/data" = false; + "zroot/home<" = true; + "zroot/home" = false; + }; + }]; + }; + }; + networking.useNetworkd = true; networking.useDHCP = false; diff --git a/nixos/default.nix b/nixos/default.nix index 40a2b2a..3183b13 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -19,6 +19,7 @@ startWhenNeeded = true; }; users.users.root.openssh.authorizedKeys.keys = [ + "command=\"zrepl stdinserver fireStore\",restrict ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM1U9DTKueKuTuu/F9wxGr3we7y00V8HMyUjVBMwFQwo root-zrepl@fireStore" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDZm0TZPBzgXrY1vrLoYviNRb/oGZQDQk9vrppPK84sN55ZPlr9VvP+JYE7Qkx8teRuH9ulxqX40+dxKaiAXMUl4HU57KPLjwCb7SnBNIFTv6ZHGxPS8ZgUzKJr4Agph51oenNEO3RziEqAo3EwK67SGnjeIYQQKcjpfwd08+PYMOjv42zSYQ9umooj5LooOvbxoogZ3VpboXv6DeyA4rev1M9RgnMWaWVF2LxJjQ3jVr7xh1vZktVGKuVk/XXKD6WVAuwmGMVEouQzjtG9kepWd8FUYe+fgj5mtdqfeQP9CypxvOcb7jT20wO1Abpp5udS9iPDQHg+lafklIAeKG3qgxxhBDH3otXtnWcoeXUmDpBI8HU/8d/yrGaLHYRfy3HHiSGFq3lBgoxi83QIOl9ELeKWMJC0fWKBApm0NU0flgwfy2j7GRyXmlM7tVFyuj5RTAZNQfgD9g054di9WbtUs7sm/9r3/rQe2+3neE3Jskt4xvZK0xbc4dZSZGn4E2JDWjENqPBvQ2dU5lsjpUKTZWAnxVGPe//BErsDxNLIHWz8emG71r3Q2yud4KPdAR9CgeC8g1bwlCI6JDFZutKBzIlE3QQ4ryKJEioiUL89xi6G+nNB7W5ABsQN0ZtWvZl8TG4Wh00B+oBXzgRER5Y9SdAYcrwWxlGVxxQyElUNrw==" ];