forked from poz/niksos
some initial syncthing work
no idea if this works
This commit is contained in:
parent
48e5e05f35
commit
142cc28acc
5 changed files with 114 additions and 3 deletions
|
@ -81,10 +81,13 @@ in {
|
|||
neovim.enable = true;
|
||||
helix.enable = true;
|
||||
};
|
||||
services.ssh = {
|
||||
services = {
|
||||
ssh = {
|
||||
agent.enable = false;
|
||||
daemon.enable = true;
|
||||
};
|
||||
syncthing.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
|
|
|
@ -359,6 +359,7 @@
|
|||
};
|
||||
};
|
||||
pipewire.enable = true;
|
||||
syncthing.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -296,6 +296,7 @@
|
|||
};
|
||||
};
|
||||
pipewire.enable = true;
|
||||
syncthing.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -5,5 +5,6 @@ _: {
|
|||
./mpd.nix
|
||||
./pipewire.nix
|
||||
./ssh.nix
|
||||
./syncthing.nix
|
||||
];
|
||||
}
|
||||
|
|
105
modules/services/syncthing.nix
Normal file
105
modules/services/syncthing.nix
Normal file
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: with lib; let
|
||||
cfg = config.myOptions.services.syncthing;
|
||||
username = config.myOptions.other.system.username;
|
||||
hmCfg = config.home-manager.users.${username};
|
||||
in {
|
||||
options.myOptions.services.syncthing = {
|
||||
enable = mkEnableOption "enable syncthing";
|
||||
extraSettings = mkOption {
|
||||
type = types.attrs;
|
||||
description = "extra per host syncthing settings";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
# https://wes.today/nixos-syncthing/
|
||||
config = let
|
||||
port = 8384;
|
||||
homeDirectory = hmCfg.home.homeDirectory;
|
||||
in mkIf cfg.enable {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
dataDir = homeDirectory;
|
||||
configDir = "${hmCfg.xdg.configHome}/syncthing";
|
||||
openDefaultPorts = true;
|
||||
user = username;
|
||||
group = "users";
|
||||
guiAddress = "0.0.0.0:${toString port}";
|
||||
overrideDevices = false;
|
||||
overrideFolders = false;
|
||||
# settings = {
|
||||
# devices = {
|
||||
# niks.id = "ZXGYWRF-THUTZFB-UUSUNFJ-6O4SP5X-WZH5DOJ-YC25NHH-EC55CIH-V7ZKFQG";
|
||||
# # del.id = "";
|
||||
# # chmura.id = "";
|
||||
# };
|
||||
# folders = {
|
||||
# Projects = {
|
||||
# path = "${homeDirectory}/Projects";
|
||||
# devices = [ "niks" /*"del" "chmura"*/ ];
|
||||
# versioning = {
|
||||
# type = "staggered";
|
||||
# params = {
|
||||
# cleanInterval = "3600";
|
||||
# maxAge = "15552000";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# Studia = {
|
||||
# path = "${homeDirectory}/Studia";
|
||||
# devices = [ "niks" /*"del" "chmura"*/ ];
|
||||
# versioning = {
|
||||
# type = "staggered";
|
||||
# params = {
|
||||
# cleanInterval = "3600";
|
||||
# maxAge = "15552000";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# KeepassXC = {
|
||||
# path = "${homeDirectory}/KeepassXC";
|
||||
# devices = [ "niks" /*"del" "chmura"*/ ];
|
||||
# versioning = {
|
||||
# type = "staggered";
|
||||
# params = {
|
||||
# cleanInterval = "3600";
|
||||
# maxAge = "15552000";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# Notes = {
|
||||
# path = "${homeDirectory}/Notes";
|
||||
# devices = [ "niks" /*"del" "chmura"*/ ];
|
||||
# versioning = {
|
||||
# type = "staggered";
|
||||
# params = {
|
||||
# cleanInterval = "3600";
|
||||
# maxAge = "15552000";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# mieszkanie = {
|
||||
# path = "${homeDirectory}/mieszkanie";
|
||||
# devices = [ "niks" /*"del" "chmura"*/ ];
|
||||
# versioning = {
|
||||
# type = "staggered";
|
||||
# params = {
|
||||
# cleanInterval = "3600";
|
||||
# maxAge = "15552000";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# } // cfg.extraSettings;
|
||||
};
|
||||
services.caddy = {
|
||||
virtualHosts."sync.jacekpoz.pl".extraConfig = ''
|
||||
reverse_proxy * localhost:${toString port}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue