completely refactor and modularize flake
This commit is contained in:
parent
3b1ed7e281
commit
b7210fcf8e
141 changed files with 884 additions and 2605 deletions
65
modules/default/common/syncthing.nix
Normal file
65
modules/default/common/syncthing.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
deviceList = builtins.attrNames config.common.syncthing.devices;
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
common.syncthing = {
|
||||
|
||||
enable = lib.mkEnableOption "enable syncthing";
|
||||
|
||||
devices = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
|
||||
options.id = lib.mkOption { type = lib.types.str; };
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.home-manager.users.willifan.services.syncthing = lib.mkIf config.common.syncthing.enable {
|
||||
enable = lib.mkDefault true;
|
||||
overrideDevices = lib.mkDefault true;
|
||||
overrideFolders = lib.mkDefault true;
|
||||
passwordFile = config.sops.secrets."syncthing/password".path;
|
||||
settings = {
|
||||
gui.user = "willifan";
|
||||
devices = config.common.syncthing.devices;
|
||||
folders = lib.mkDefault {
|
||||
"Documents" = {
|
||||
id = "jtl6g-qjmwo";
|
||||
path = "/mnt/data/Documents";
|
||||
devices = deviceList;
|
||||
};
|
||||
"Enpass" = lib.mkDefault {
|
||||
id = "ciksm-xsw4m";
|
||||
path = "/mnt/data/Enpass";
|
||||
devices = deviceList;
|
||||
};
|
||||
"Pictures" = lib.mkDefault {
|
||||
id = "po4qj-q9t0t";
|
||||
path = "/mnt/data/Pictures";
|
||||
devices = deviceList;
|
||||
};
|
||||
"Videos" = lib.mkDefault {
|
||||
id = "4wqf5-xasng";
|
||||
path = "/mnt/data/Videos";
|
||||
devices = deviceList;
|
||||
};
|
||||
"Notes" = lib.mkDefault {
|
||||
id = "oc61n-iewgj";
|
||||
path = "/mnt/data/Notes";
|
||||
devices = deviceList;
|
||||
};
|
||||
"Music" = lib.mkDefault {
|
||||
id = "xxh8a-3y2tq";
|
||||
path = "/mnt/data/Music";
|
||||
devices = deviceList;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue