Files
nix/modules/syncthing/default.nix
2026-02-21 13:49:53 +01:00

34 lines
599 B
Nix

{
lib,
config,
...
}:
with lib;
let
cfg = config.my.syncthing;
in
{
options.my.syncthing = {
enable = mkEnableOption "Syncthing file synchronization";
username = mkOption {
type = types.str;
default = "h";
};
};
config = mkIf cfg.enable {
users.groups.${cfg.username} = { };
users.users.${cfg.username}.extraGroups = [ cfg.username ];
services.syncthing = {
enable = true;
user = cfg.username;
group = cfg.username;
configDir = "/home/${cfg.username}/.local/state/syncthing";
openDefaultPorts = true;
};
};
}