add the syncthing service
This commit is contained in:
parent
25d5980e6c
commit
0a1dcf0a6a
4 changed files with 80 additions and 19 deletions
|
|
@ -35,15 +35,16 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
myHomeManager.bundles.desktop.enable = true;
|
myHomeManager = {
|
||||||
|
bundles = {
|
||||||
myHomeManager.bundles.maker.enable = true;
|
desktop.enable = true;
|
||||||
|
maker.enable = true;
|
||||||
|
};
|
||||||
|
syncthing.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
# programs.home-manager.enable = true;
|
# programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,18 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
cfg = config.myHomeManager;
|
cfg = config.myHomeManager;
|
||||||
# # Taking all modules in ./features and adding enables to them
|
# Taking all modules in ./features and adding enables to them
|
||||||
# features =
|
features =
|
||||||
# helperLib.extendModules
|
helperLib.extendModules
|
||||||
# (name: {
|
(name: {
|
||||||
# extraOptions = {
|
extraOptions = {
|
||||||
# myHomeManager.${name}.enable = lib.mkEnableOption "enable my ${name} configuration";
|
myHomeManager.${name}.enable = lib.mkEnableOption "enable my ${name} configuration";
|
||||||
# };
|
};
|
||||||
#
|
|
||||||
# configExtension = config: (lib.mkIf cfg.${name}.enable config);
|
configExtension = config: (lib.mkIf cfg.${name}.enable config);
|
||||||
# })
|
})
|
||||||
# (helperLib.filesIn ./features);
|
(helperLib.filesIn ./features);
|
||||||
#
|
|
||||||
# Taking all module bundles in ./bundles and adding bundle.enables to them
|
# Taking all module bundles in ./bundles and adding bundle.enables to them
|
||||||
bundles =
|
bundles =
|
||||||
helperLib.extendModules
|
helperLib.extendModules
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
]
|
]
|
||||||
# ++ features
|
++ features
|
||||||
++ bundles
|
++ bundles
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
53
modules/home/features/syncthing.nix
Normal file
53
modules/home/features/syncthing.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
saintAlphonsoID = "LHASNUO-CXALARH-XI3TU4U-OCULV72-HS3HQ35-P4FECIT-UZ5VMSZ-PMCEPQH";
|
||||||
|
|
||||||
|
webGuiPort = [ 8384 ];
|
||||||
|
cfg = config;
|
||||||
|
in {
|
||||||
|
imports = [];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
rootDir = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "/home/${cfg.myNixOS.sharedSettings.mainUser}/sync";
|
||||||
|
};
|
||||||
|
|
||||||
|
remoteGui = lib.mkEnableOption "Enable port for remote WebGUI";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
user = cfg.myNixOS.sharedSettings.mainUser;
|
||||||
|
dataDir = config.rootDir;
|
||||||
|
configDir = "/home/${cfg.myNixOS.sharedSettings.mainUser}/.config/syncthing";
|
||||||
|
overrideDevices = true;
|
||||||
|
overrideFolders = true;
|
||||||
|
settings = {
|
||||||
|
devices = {
|
||||||
|
"saintAlphonso" = { id = saintAlphonsoID; };
|
||||||
|
};
|
||||||
|
folders = {
|
||||||
|
"KeepassXC" = {
|
||||||
|
path = "/home/${cfg.myNixOS.sharedSettings.mainUser}/KeepassXC";
|
||||||
|
devices = [ "saintAlphonso" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# # Syncthing ports: 8384 for remote access to GUI
|
||||||
|
# # 22000 TCP and/or UDP for sync traffic
|
||||||
|
# # 21027/UDP for discovery
|
||||||
|
# # source: https://docs.syncthing.net/users/firewall.html
|
||||||
|
# networking.firewall.allowedTCPPorts =
|
||||||
|
# [ 22000 ]
|
||||||
|
# ++ webGuiPort;
|
||||||
|
#
|
||||||
|
# networking.firewall.allowedUDPPorts = [ 22000 21027 ];
|
||||||
|
}
|
||||||
|
|
@ -58,6 +58,13 @@ in {
|
||||||
sharedSettings = {
|
sharedSettings = {
|
||||||
# put settings here that are shared between homemanager and nixos, e.g.
|
# put settings here that are shared between homemanager and nixos, e.g.
|
||||||
# hyprland.enable = lib.mkEnableOption "enable hyprland";
|
# hyprland.enable = lib.mkEnableOption "enable hyprland";
|
||||||
|
|
||||||
|
mainUser = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "prunebutt";
|
||||||
|
example = "mainUser";
|
||||||
|
description = "The main user that runs the system";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue