66 lines
2.4 KiB
Nix

{
# Snowfall Lib provides a customized `lib` instance with access to your flake's library
# as well as the libraries available from your flake's inputs.
lib,
# An instance of `pkgs` with your overlays and packages applied is also available.
pkgs,
# You also have access to your flake's inputs.
inputs,
# Additional metadata is provided by Snowfall Lib.
namespace, # The namespace used for your flake, defaulting to "internal" if not set.
system, # The system architecture for this host (eg. `x86_64-linux`).
target, # The Snowfall Lib target for this system (eg. `x86_64-iso`).
format, # A normalized name for the system target (eg. `iso`).
virtual, # A boolean to determine whether this system is a virtual target using nixos-generators.
systems, # An attribute map of your defined hosts.
# All other arguments come from the module system.
config,
...
}:
let
cfg = config.modules.syncthing;
in
{
options.modules.syncthing = {
enable = lib.mkOption { default = false; };
};
config = lib.mkIf cfg.enable {
services.syncthing.enable = true;
services.syncthing.user = "julian";
services.syncthing.openDefaultPorts = true;
services.syncthing.configDir = "/home/julian/.config/syncthing";
# services.syncthing.
#services.syncthing.key = config.sops.secrets."aspi/syncthing/key".path;
#services.syncthing.cert = config.sops.secrets."aspi/syncthing/cert".path;
services.syncthing.overrideDevices = false; # overrides any devices added or deleted through the WebUI
services.syncthing.overrideFolders = false; # overrides any folders added or deleted through the WebUI
# services.syncthing.settings = {
# devices = {
# "pianopi" = {
# id = "FD3XSFW-7LQSCIQ-KHZPLNQ-7VZYGKH-RJ2ZKTJ-BG67NRH-36TQIZM-CXDYWAH";
# };
# };
# folders = {
# "Documents" = {
# # Name of folder in Syncthing, also the folder ID
# path = "/home/myusername/Documents"; # Which folder to add to Syncthing
# devices = [
# "device1"
# "device2"
# ]; # Which devices to share the folder with
# };
# "Example" = {
# path = "/home/myusername/Example";
# devices = [ "device1" ];
# ignorePerms = false; # By default, Syncthing doesn't sync file permissions. This line enables it for this folder.
# };
# };
# };
};
}