feat: add syncthing

This commit is contained in:
Felix Schröter 2020-10-06 17:41:56 +02:00
parent 24c63b4375
commit 3b43500a12
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58
6 changed files with 104 additions and 11 deletions

View file

@ -8,6 +8,7 @@
./system ./system
./desktop ./desktop
./virtualisation/docker.nix ./virtualisation/docker.nix
./services/syncthing/felix-nixos.nix
./services/jellyfin.nix ./services/jellyfin.nix
]; ];

View file

@ -8,6 +8,7 @@
./desktop/monitors.nix ./desktop/monitors.nix
./vpn.nix ./vpn.nix
./git.nix ./git.nix
./syncthing.nix
./keybase.nix ./keybase.nix
./signal.nix ./signal.nix
./browsers ./browsers

5
home/syncthing.nix Normal file
View file

@ -0,0 +1,5 @@
{ config, pkgs, ... }:
{
services.syncthing.tray = true;
}

View file

@ -1,14 +1,14 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with builtins; with builtins; {
{
imports = [ imports = [
# ./hardware/base.nix # ./hardware/base.nix
# ./system # ./system
./system/nix.nix ./system/nix.nix
./system/i18n.nix ./system/i18n.nix
./services/jellyfin.nix
./modules/cfdyndns.nix ./modules/cfdyndns.nix
./services/syncthing/felix-nixos.nix
./services/jellyfin.nix
./services/home-assistant.nix ./services/home-assistant.nix
]; ];
@ -19,17 +19,12 @@ with builtins;
boot.loader.raspberryPi.enable = true; boot.loader.raspberryPi.enable = true;
boot.loader.raspberryPi.version = 4; boot.loader.raspberryPi.version = 4;
boot.kernelPackages = pkgs.linuxPackages_rpi4; boot.kernelPackages = pkgs.linuxPackages_rpi4;
boot.kernelParams = [ boot.kernelParams = [ "console=ttyAMA0,115200" "console=tty1" ];
"console=ttyAMA0,115200"
"console=tty1"
];
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
networking.domain = "home.felschr.com"; networking.domain = "home.felschr.com";
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [ 80 443 ];
80 443
];
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;

View file

@ -0,0 +1,44 @@
{ config, pkgs, ... }:
{
services.syncthing = {
enable = true;
openDefaultPorts = true;
user = "felschr";
configDir = "/home/felschr/.config/syncthing";
dataDir = "/home/felschr/.local/share/syncthing";
declarative = {
cert = "/etc/nixos/secrets/syncthing/cert.pem";
key = "/etc/nixos/secrets/syncthing/key.pem";
devices = {
rpi4 = {
id =
"RBKVWQQ-TGYBMQK-P4AADKE-7LGPHL7-UY4FEZA-6N7HQ4R-UCPSZPV-LWFK4AP";
};
pixel3 = {
id =
"EUW6XKB-XWM4L2L-7Q46YGM-KD4JX3U-OFE5AAC-B3JT6QY-5YSPXXI-W7OKCQO";
};
};
folders = {
"Default" = {
id = "default";
path = "/home/felschr/sync/default";
devices = [ "rpi4" "pixel3" ];
};
"Backups" = {
id = "backups";
path = "/home/felschr/sync/backups";
type = "sendonly";
devices = [ "rpi4" ];
};
"Media" = {
id = "media";
path = "/home/felschr/sync/media";
type = "sendonly";
devices = [ "rpi4" ];
};
};
};
};
}

View file

@ -0,0 +1,47 @@
{ config, pkgs, ... }:
{
services.syncthing = {
enable = true;
openDefaultPorts = true;
user = "felschr";
configDir = "/home/felschr/.config/syncthing";
dataDir = "/home/felschr/.local/share/syncthing";
declarative = {
cert = "/etc/nixos/secrets/syncthing/cert.pem";
key = "/etc/nixos/secrets/syncthing/key.pem";
devices = {
felix-nixos = {
id =
"MKVEPJK-HWGFVLN-SRHE4NR-ZADXKMF-AMYIKZ7-MGUJH3L-XH2FBOW-AMQRIAW";
};
pixel3 = {
id =
"EUW6XKB-XWM4L2L-7Q46YGM-KD4JX3U-OFE5AAC-B3JT6QY-5YSPXXI-W7OKCQO";
};
};
# TODO switch to external storage
folders = {
"Default" = {
id = "default";
path = "/home/felschr/sync/default";
devices = [ "felix-nixos" "pixel3" ];
};
"Backups" = {
id = "backups";
path = "/home/felschr/sync/backups";
type = "receiveonly";
ignoreDelete = true;
devices = [ "felix-nixos" ];
};
"Media" = {
id = "media";
path = "/home/felschr/sync/media";
type = "receiveonly";
ignoreDelete = true;
devices = [ "felix-nixos" ];
};
};
};
};
}