add(syncthing): add module for syncthing with basic configuration
This commit is contained in:
parent
6fc0965e15
commit
817858d6ee
2 changed files with 45 additions and 0 deletions
44
modules/nixos/services/syncthing/default.nix
Normal file
44
modules/nixos/services/syncthing/default.nix
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
with lib.${namespace};
|
||||||
|
let
|
||||||
|
cfg = config.${namespace}.services.syncthing;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.${namespace}.services.syncthing = {
|
||||||
|
enable = mkEnableOption "Syncthing";
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
description = "The port to serve Syncthing on.";
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = 8384;
|
||||||
|
};
|
||||||
|
|
||||||
|
ip = mkOption {
|
||||||
|
description = "The ip to serve Syncthing on.";
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = "192.168.10.3";
|
||||||
|
};
|
||||||
|
|
||||||
|
openDefaultPorts = mkEnableOption "Whether to open the default ports in the firewall.";
|
||||||
|
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
cfg.port
|
||||||
|
];
|
||||||
|
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
guiAddress = "${cfg.ip}:${toString cfg.port}";
|
||||||
|
openDefaultPorts = mkIf cfg.openDefaultPorts true;
|
||||||
|
dataDir = "/data/syncthing";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -61,6 +61,7 @@ with lib.${namespace};
|
||||||
searxng = enabled;
|
searxng = enabled;
|
||||||
#immich = enabled; # We wait for the proper version to be in nixpkgs
|
#immich = enabled; # We wait for the proper version to be in nixpkgs
|
||||||
paperless = enabled;
|
paperless = enabled;
|
||||||
|
syncthing = enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#container.invidious = enabled;
|
#container.invidious = enabled;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue