refactor: moved nixos modules to dendrite pattern
This commit is contained in:
parent
df8dd110ad
commit
0ea11e0236
219 changed files with 4802 additions and 4820 deletions
38
modules/nixos/programs/sync/sync.nix
Normal file
38
modules/nixos/programs/sync/sync.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{...}: {
|
||||
flake.nixosModules.sync-service = {
|
||||
config,
|
||||
lib,
|
||||
syncthingConfiguration,
|
||||
...
|
||||
}: let
|
||||
mountDir = "/mnt/sync";
|
||||
configDir = "/etc/syncthing";
|
||||
in {
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
systemd = lib.mkIf config.services.syncthing.enable {
|
||||
tmpfiles.rules = [
|
||||
"A ${mountDir} - - - - u:syncthing:rwX,g:syncthing:rwX,o::-"
|
||||
"d ${mountDir} 2755 syncthing syncthing -"
|
||||
"d ${config.services.syncthing.dataDir} 775 syncthing syncthing -"
|
||||
"d ${config.services.syncthing.configDir} 755 syncthing syncthing -"
|
||||
];
|
||||
};
|
||||
}
|
||||
(lib.mkIf config.services.syncthing.enable (lib.mkMerge [
|
||||
{
|
||||
services.syncthing = {
|
||||
user = "syncthing";
|
||||
group = "syncthing";
|
||||
dataDir = "${mountDir}/default";
|
||||
configDir = configDir;
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
configuration = syncthingConfiguration;
|
||||
deviceName = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
]))
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue