1
0
Fork 0

Revert "WIP: Split Syncthing out into separate module"

This reverts commit 52be766f61.
This commit is contained in:
Aires 2024-06-30 23:52:00 -04:00
parent 52be766f61
commit 770b5c0850
2 changed files with 23 additions and 47 deletions

View file

@ -139,16 +139,30 @@ with lib;
# Enable Syncthing
(mkIf cfg.services.syncthing.enable {
imports = [
(import ../common/home-manager/syncthing.nix {
username = users.users.aires.name;
configDir = "${config.users.users.aires.home}/.config/syncthing";
port = 8080;
autostart = cfg.services.syncthing.autostart;
enableTray = cfg.services.syncthing.autostart;
inherit lib pkgs;
})
users.users.aires.packages = [
pkgs.syncthing
(mkIf cfg.services.syncthing.enableTray pkgs.syncthingtray)
];
# Open port 8080
networking.firewall.allowedTCPPorts = [ 8080 ];
home-manager.users.aires = {
# Syncthing options
services.syncthing = {
enable = true;
extraOptions = [
"--gui-address=0.0.0.0:8080"
"--home=${config.users.users.aires.home}/.config/syncthing"
"--no-default-folder"
];
};
# Override the default Syncthing settings so it doesn't start on boot
systemd.user.services."syncthing" = mkIf (!cfg.services.syncthing.autostart) {
Install = lib.mkForce { };
};
};
})
]);
}

View file

@ -1,38 +0,0 @@
{
username,
configDir,
port ? 8080,
autostart ? false,
enableTray ? false,
lib,
pkgs,
config,
...
}:
{
config = {
users.users.${username}.packages = [
pkgs.syncthing
(lib.mkIf enableTray pkgs.syncthingtray)
];
# Open port 8080
networking.firewall.allowedTCPPorts = [ port ];
home-manager.users.${username} = {
# Syncthing options
services.syncthing = {
enable = true;
extraOptions = [
"--gui-address=0.0.0.0:${port}"
"--home=${configDir}/.config/syncthing"
"--no-default-folder"
];
};
# Override the default Syncthing settings so it doesn't start on boot
systemd.user.services."syncthing" = lib.mkIf (!autostart) { Install = lib.mkForce { }; };
};
};
}