From f1dc2b4b51d2ef151ebeab85dea1b95ae8e806f6 Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Tue, 3 Apr 2018 08:47:49 +0200 Subject: [PATCH] Nouveaux services --- hardware-configuration.nix | 34 ++++++++++++++++++++++------------ services.nix | 26 +++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 7b3d787c3..c34888724 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -22,16 +22,6 @@ fsType = "vfat"; }; - fileSystems."/mnt/loutrepool" = - { device = "loutrepool"; - fsType = "zfs"; - }; - - fileSystems."/mnt/containers_volumes" = - { device = "loutrepool/containers_volumes"; - fsType = "zfs"; - }; - fileSystems."/mnt/medias" = { device = "loutrepool/medias"; fsType = "zfs"; @@ -47,8 +37,28 @@ fsType = "zfs"; }; - fileSystems."/mnt/influxdb" = - { device = "loutrepool/etc/influxdb"; + fileSystems."/var/db/influxdb" = + { device = "loutrepool/var/influxdb"; + fsType = "zfs"; + }; + + fileSystems."/var/lib/grafana" = + { device = "loutrepool/var/grafana"; + fsType = "zfs"; + }; + + fileSystems."/var/lib/emby/ProgramData-Server" = + { device = "loutrepool/var/emby"; + fsType = "zfs"; + }; + + fileSystems."/var/lib/syncthing" = + { device = "loutrepool/var/syncthing"; + fsType = "zfs"; + }; + + fileSystems."/var/lib/duplicati" = + { device = "loutrepool/var/duplicati"; fsType = "zfs"; }; diff --git a/services.nix b/services.nix index fdc9cce70..79debc89b 100644 --- a/services.nix +++ b/services.nix @@ -2,7 +2,7 @@ { services.influxdb.enable = true; - services.influxdb.dataDir = "/mnt/influxdb"; + services.influxdb.dataDir = "/var/db/influxdb"; services.telegraf.enable = true; services.telegraf.extraConfig = { @@ -23,9 +23,33 @@ services.grafana.enable = true; services.grafana.addr = "0.0.0.0"; + services.grafana.dataDir = "/var/lib/grafana"; services.emby.enable = true; + services.emby.dataDir = "/var/lib/emby/ProgramData-Server"; + services.syncthing.enable = true; + services.syncthing.dataDir = "/var/lib/syncthing"; + services.syncthing.openDefaultPorts = true; + + systemd = { + services.duplicati = { + description = "Duplicati backup"; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Slice = "machine.slice"; + ExecStart = "${pkgs.rkt}/bin/rkt --insecure-options=image --pull-policy=update run --volume volume-config,kind=host,source=/var/lib/duplicati --volume volume-source,kind=host,source=/mnt/medias,readOnly=true --port 8200-tcp:8200 --dns 8.8.8.8 --dns 8.8.4.4 docker://linuxserver/duplicati"; + ExecStopPost = "/usr/bin/rkt gc --mark-only"; + KillMode = "mixed"; + Restart = "on-failure"; + RestartSec = 3; + }; + enable = true; + }; + }; + networking.firewall.allowedTCPPorts = [ 3000 # Grafana 8096 # Emby