From 2fa7de4fba120a21cee5b37bf6207c2b3800172a Mon Sep 17 00:00:00 2001 From: tomoron Date: Thu, 6 Mar 2025 01:18:52 +0100 Subject: [PATCH] actually using unison intead of doing weird things --- homeConfigs/home.nix | 4 ++-- homeConfigs/hosts/laptop.nix | 2 ++ homeConfigs/modules/sync.nix | 30 ++++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/homeConfigs/home.nix b/homeConfigs/home.nix index e108962..618c634 100644 --- a/homeConfigs/home.nix +++ b/homeConfigs/home.nix @@ -6,7 +6,7 @@ # By: tomoron +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/10/17 18:15:38 by tomoron #+# #+# # -# Updated: 2025/02/28 19:04:49 by tomoron ### ########.fr # +# Updated: 2025/03/05 23:44:33 by tomoron ### ########.fr # # # # **************************************************************************** # @@ -68,7 +68,7 @@ ref = "master"; }}/themes"; - ".local/bin/desk_sync".source = dotfiles/local/bin/desk_sync; +# ".local/bin/desk_sync".source = dotfiles/local/bin/desk_sync; }; programs.home-manager.enable = true; } diff --git a/homeConfigs/hosts/laptop.nix b/homeConfigs/hosts/laptop.nix index 6c64f24..403ed6b 100644 --- a/homeConfigs/hosts/laptop.nix +++ b/homeConfigs/hosts/laptop.nix @@ -38,4 +38,6 @@ stremio blender ]; + + mods.sync.syncedAdditions = ["VirtualBox VMs"]; } diff --git a/homeConfigs/modules/sync.nix b/homeConfigs/modules/sync.nix index 1e7fbf6..29a8361 100644 --- a/homeConfigs/modules/sync.nix +++ b/homeConfigs/modules/sync.nix @@ -1,11 +1,14 @@ { lib, config, ... }: +let + defPathLst = ["Desktop" "Downloads" ".mozilla"]; +in { options.mods.sync = { enable = lib.mkOption { type = lib.types.bool; default = true; - description = "enable usr_sync command"; + description = "setup unison"; }; homeFolder = lib.mkOption { @@ -19,13 +22,28 @@ default = "/raid/pc_sync"; description = "where on the server"; }; + + defaultSynced = lib.mkOption { + type = lib.types.bool; + default = true; + description = "should it add the default paths"; + }; + + syncedAdditions = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + description = "list of path that will be synced"; + }; }; - config.home.file.".local/bin/usr_sync" = lib.mkIf config.mods.sync.enable { - text = '' - #!/bin/env - unison "${config.mods.sync.homeFolder}" "ssh://tom@tmoron.fr:1880/${config.mods.sync.destFolder}" $@ - ''; + config.home.file.".unison/test.prf" = lib.mkIf config.mods.sync.enable { + text = (lib.strings.concatStrings ['' + auto=true + root=${config.mods.sync.homeFolder} + root=ssh://tom@tmoron.fr:1880/${config.mods.sync.destFolder} + '' + (lib.strings.concatMapStrings (x: "\npath=" + x) (( if config.mods.sync.defaultSynced then defPathLst else [] ) ++ config.mods.sync.syncedAdditions )) + ]); executable = true; }; }