From 686b85e94c446d8f237a04d72672d9ea22d2c3de Mon Sep 17 00:00:00 2001 From: tomoron Date: Fri, 14 Mar 2025 14:03:09 +0100 Subject: [PATCH] add hostname to ft config --- homeConfigs/hosts/ft.nix | 3 +++ homeConfigs/modules/sync.nix | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/homeConfigs/hosts/ft.nix b/homeConfigs/hosts/ft.nix index be3228d..22d52d3 100644 --- a/homeConfigs/hosts/ft.nix +++ b/homeConfigs/hosts/ft.nix @@ -13,6 +13,9 @@ programs.firefox.enable = false; mods.sync.homeFolder = "/sgoinfre/goinfre/Perso/tomoron"; + mods.sync.defaultSynced = false; + mods.sync.syncedAdditions = [ "42_desktop" "downloads" ]; + mods.sync.customHostName = "pc42"; programs.bash.profileExtra = '' diff --git a/homeConfigs/modules/sync.nix b/homeConfigs/modules/sync.nix index cdacd99..48c0844 100644 --- a/homeConfigs/modules/sync.nix +++ b/homeConfigs/modules/sync.nix @@ -1,7 +1,7 @@ { lib, config, ... }: let - defPathLst = ["Desktop" "Downloads"]; + defPathLst = ["desktop" "42_desktop" "downloads"]; in { options.mods.sync = { @@ -34,6 +34,12 @@ in default = []; description = "list of path that will be synced"; }; + + customHostName = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + description = "hostname used by unison"; + }; }; config.home.file.".unison/default.prf" = lib.mkIf config.mods.sync.enable { @@ -43,7 +49,7 @@ in 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; + (if !(isNull config.mods.sync.customHostName) then "\nclientHostName=${config.mods.sync.customHostName}" else "") + ]); }; }