From 3cc299a59572c8c9c09b67fc26cfc699355447fd Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Sun, 11 Feb 2024 15:53:44 +0100 Subject: setup syncthing on lemptop and pump --- profiles/core/configuration.nix | 4 ++-- profiles/core/hm.nix | 2 +- profiles/core/home.nix | 3 ++- profiles/core/syncthing.nix | 39 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 6 deletions(-) (limited to 'profiles/core') diff --git a/profiles/core/configuration.nix b/profiles/core/configuration.nix index 36dc255..d8ad29f 100644 --- a/profiles/core/configuration.nix +++ b/profiles/core/configuration.nix @@ -66,7 +66,7 @@ file pstree bc - ] ++ optionals (!machine.isDarwin) [ + ] ++ (optionals (!machine.isDarwin) [ pkgsi686Linux.glibc gdb pciutils @@ -74,7 +74,7 @@ iputils inetutils usbutils - ]; + ]); nix.package = pkgs.nixUnstable; nix.extraOptions = '' diff --git a/profiles/core/hm.nix b/profiles/core/hm.nix index 76dd2e6..efa83af 100644 --- a/profiles/core/hm.nix +++ b/profiles/core/hm.nix @@ -1,4 +1,4 @@ -{inputs, lib, pkgs, ...}: with lib; { +{inputs, config, lib, pkgs, ...}: with lib; { imports = [ (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" ivi.username ]) ]; diff --git a/profiles/core/home.nix b/profiles/core/home.nix index 7972a75..78abfe7 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -35,7 +35,7 @@ }; }; desktopEntries = with pkgs; optionalAttrs (!machine.isDarwin) { - text= { type = "Application"; name = "Text editor"; exec = "${st}/bin/st -e kak %u"; }; + text = { type = "Application"; name = "Text editor"; exec = "${st}/bin/st -e kak %u"; }; file = { type = "Application"; name = "File Manager"; exec = "${st}/bin/st -e lfub %u"; }; torrent = { type = "Application"; name = "Torrent"; exec = "${coreutils}/bin/env transadd %U"; }; img = { type = "Application"; name = "Image Viewer"; exec = "${sxiv}/bin/sxiv -a %u"; }; @@ -186,6 +186,7 @@ enableSshSupport = true; defaultCacheTtl = 34550000; maxCacheTtl = 34550000; + pinentryFlavor = "gtk2"; }; }; } diff --git a/profiles/core/syncthing.nix b/profiles/core/syncthing.nix index e5c19f7..a1767a6 100644 --- a/profiles/core/syncthing.nix +++ b/profiles/core/syncthing.nix @@ -3,16 +3,51 @@ enable = true; user = ivi.username; inherit (config.ivi) group; + dataDir = config.ivi.home; overrideDevices = true; overrideFolders = true; key = config.secrets.syncthing.path; - settings = { + settings = let + allDevices = (filterAttrs (_: m: m.syncthing.id != "") ivi.machines); + in { + gui = { + theme = "default"; + insecureAdminAccess = true; + }; + devices = mapAttrs (_: m: { inherit (m.syncthing) id; introducer = m.isServer; - }) (filterAttrs (_: m: m.syncthing.enable) ivi.machines); + }) allDevices; + + folders = let + trashcan = { + type = "trashcan"; + params.cleanoutDays = "0"; + }; + simple = { + type = "simple"; + params = { + keep = "5"; + cleanoutDays = "0"; + }; + }; + allNames = attrNames allDevices; + in { + my = { + path = "${config.ivi.home}/sync/my"; + devices = allNames; + versioning = simple; + }; + pictures = { + path = "${config.ivi.home}/sync/pictures"; + devices = allNames; + versioning = trashcan; + }; + }; }; }; + environment.systemPackages = [config.services.syncthing.package]; } -- cgit v1.2.3