]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/system/backup-2.nix
Migrate to morph as a replacement to nixops
[perso/Immae/Config/Nix.git] / modules / private / system / backup-2.nix
index 1d84667de9ba6d794abc28f4be5dda23f0b32c0a..d1064c7a5dec513f51f10535ea693307327e530b 100644 (file)
@@ -1,26 +1,22 @@
 { privateFiles }:
-{ config, pkgs, resources, ... }:
+{ config, pkgs, resources, name, ... }:
 {
+  deployment = {
+    targetUser = "root";
+    targetHost = config.hostEnv.ips.main.ip4;
+    substituteOnDestination = true;
+  };
   boot.kernelPackages = pkgs.linuxPackages_latest;
   myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
 
-  imports = builtins.attrValues (import ../..);
-
-  deployment = {
-    targetEnv = "hetznerCloud";
-    hetznerCloud = {
-      authToken = config.myEnv.hetznerCloud.authToken;
-      datacenter = "hel1-dc2";
-      location  ="hel1";
-      serverType = "cx11";
-    };
-  };
+  imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ] ++ builtins.attrValues (import ../..);
 
   fileSystems = {
     "/backup2" = {
       fsType = "ext4";
       device = "UUID=b9425333-f567-435d-94d8-b26c22d93426";
     };
+    "/" = { device = "/dev/sda1"; fsType = "ext4"; };
   };
 
   networking = {
     defaultGateway6 = { address = "fe80::1"; interface = "ens3"; };
   };
 
+  boot.loader.grub.device = "nodev";
+
   myServices.certificates.enable = true;
+  security.acme.certs."${name}" = {
+    user = config.services.nginx.user;
+    group = config.services.nginx.group;
+  };
   services.nginx = {
     enable = true;
     recommendedOptimisation = true;
@@ -50,7 +52,6 @@
 
   services.rsyncBackup = {
     mountpoint = "/backup2";
-    mailto = config.myEnv.rsync_backup.mailto;
     profiles = config.myEnv.rsync_backup.profiles;
     ssh_key_public = config.myEnv.rsync_backup.ssh_key.public;
     ssh_key_private = config.myEnv.rsync_backup.ssh_key.private;
     postgresql = {
       enable = true;
       base = "/backup2";
+      mainPackage = pkgs.postgresql;
       hosts = {
         eldiron = {
           slot = "backup_2";
           connection = "postgresql://backup-2:${config.hostEnv.ldap.password}@eldiron.immae.eu";
+          package = pkgs.postgresql;
         };
       };
     };
   # database servers. You should change this only after NixOS release
   # notes say you should.
   # https://nixos.org/nixos/manual/release-notes.html
-  system.stateVersion = "19.03"; # Did you read the comment?
+  system.stateVersion = "20.03"; # Did you read the comment?
 }