Add unused syncthing instance

This commit is contained in:
Vili Sinervä 2024-06-02 01:31:02 +03:00
parent 22aec3c470
commit aa92958b6a
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
3 changed files with 41 additions and 50 deletions

View file

@ -1,30 +1,4 @@
{ config, pkgs, lib, ... }:
let
unison-conf = "${pkgs.writeText "unison-conf"
''
root = /home/vili
root = ssh://nixos-cpu.vsinerva.fi//home/vili
watch = true
repeat = watch
prefer = newer
diff = diff -y -W 79 --suppress-common-lines
copyprog = rsync --inplace --compress
copyprogrest = rsync --partial --inplace --compress sshargs = -C
path = Desktop
path = Documents
path = Downloads
path = Music
path = Pictures
path = Projects
path = Public
path = School
path = Templates
path = Videos
path = Zotero
''}";
in
{
networking = {
hostName = "helium";
@ -71,6 +45,7 @@ in
imports = [
../base.nix
../vili.nix
../syncthing.nix
../desktop.nix
../development.nix
../misc/libinput.nix
@ -91,30 +66,6 @@ in
zenmonitor moonlight-qt parsec-bin via
];
systemd.services = {
unisonConfSymlink = {
wantedBy = [ "multi-user.target" ];
description = "Symlink for unison conf";
serviceConfig = {
Type = "oneshot";
User = "vili";
ExecStartPre = ''${pkgs.coreutils-full}/bin/mkdir -p /home/vili/.unison'';
ExecStart = ''${pkgs.coreutils-full}/bin/ln -sf ${unison-conf} /home/vili/.unison/cpu.prf'';
};
};
unisonSync = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
description = "unison filesync";
serviceConfig = {
Type = "exec";
User = "vili";
ExecStart = ''${pkgs.unison}/bin/unison -sshcmd ${pkgs.openssh}/bin/ssh cpu'';
};
};
};
# HARDWARE SPECIFIC
boot.initrd.kernelModules = [ "amdgpu" ];
hardware = {

View file

@ -6,6 +6,7 @@
../base.nix
../development.nix
../vili.nix
../syncthing.nix
];
# HARDWARE SPECIFIC

39
syncthing.nix Normal file
View file

@ -0,0 +1,39 @@
# Syncthing instance
{ config, pkgs, ... }:
{
services.syncthing = {
enable = true;
user = "vili";
dataDir = "/home/vili/";
settings = {
devices = {
};
folders =
let
default = {
devices = [];
versioning = {
type = "trashcan";
params.cleanoutDays = "30";
};
};
in
{
"~/Desktop" = default;
};
options = {
urAccepted = -1;
localAnnounceEnabled = false;
globalAnnounceEnabled = false;
natEnabled = false;
relaysEnabled = false;
};
};
#TCP/UDP 22000 for transfers and UDP 21027 for discovery
openDefaultPorts = true;
};
}