79 lines
2 KiB
Nix
79 lines
2 KiB
Nix
# base level inputs and arguments, should only ever be self and/or inputs
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
# module name declaration
|
|
flake.nixosModules.syncthing =
|
|
|
|
# function inputs and arguments
|
|
{ pkgs, user-parts, ... }:
|
|
|
|
# system level configuration options
|
|
{
|
|
|
|
# opens network ports for syncthing
|
|
networking.firewall = {
|
|
allowedTCPPorts = [ 8384 ];
|
|
allowedUDPPorts = [ 8384 ];
|
|
extraCommands = ''
|
|
iptables -I INPUT -m pkttype --pkt-type multicast -j ACCEPT
|
|
iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT
|
|
iptables -I INPUT -p udp -m udp --match multiport --dports 1990,2021 -j ACCEPT
|
|
'';
|
|
};
|
|
|
|
# system level syncthing options go here
|
|
services.syncthing = {
|
|
enable = true;
|
|
openDefaultPorts = true;
|
|
settings = {
|
|
gui = {
|
|
theme = "black";
|
|
};
|
|
};
|
|
};
|
|
|
|
# user level configuration options
|
|
home-manager.users.${user-parts.user.username} = {
|
|
|
|
# import home manager modules here
|
|
#imports = [ ];
|
|
|
|
# syncthing packages to include
|
|
home.packages = with pkgs; [
|
|
git-sync # for sync version control
|
|
];
|
|
|
|
# user level syncthing options go here
|
|
services.syncthing = {
|
|
enable = true;
|
|
guiAddress = "127.0.0.1:8384";
|
|
};
|
|
|
|
# sync version control
|
|
services.git-sync = {
|
|
|
|
enable = true;
|
|
|
|
# obsidian notes vault lives here
|
|
repositories.notes = {
|
|
path = "${user-parts.user.home-directory}/Sync/notes/";
|
|
uri = "git@codeberg.org:${user-parts.git.username}/notes.git";
|
|
interval = 1000;
|
|
};
|
|
|
|
# password kbdx file lives here
|
|
repositories.keyring = {
|
|
path = "${user-parts.user.home-directory}/Sync/keyring";
|
|
uri = "git@codeberg.org:${user-parts.git.username}/keyring";
|
|
interval = 1000;
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|