add hostname to ft config

This commit is contained in:
2025-03-14 14:03:09 +01:00
parent 8fd63e2d59
commit 686b85e94c
2 changed files with 12 additions and 3 deletions

View File

@ -13,6 +13,9 @@
programs.firefox.enable = false; programs.firefox.enable = false;
mods.sync.homeFolder = "/sgoinfre/goinfre/Perso/tomoron"; mods.sync.homeFolder = "/sgoinfre/goinfre/Perso/tomoron";
mods.sync.defaultSynced = false;
mods.sync.syncedAdditions = [ "42_desktop" "downloads" ];
mods.sync.customHostName = "pc42";
programs.bash.profileExtra = programs.bash.profileExtra =
'' ''

View File

@ -1,7 +1,7 @@
{ lib, config, ... }: { lib, config, ... }:
let let
defPathLst = ["Desktop" "Downloads"]; defPathLst = ["desktop" "42_desktop" "downloads"];
in in
{ {
options.mods.sync = { options.mods.sync = {
@ -34,6 +34,12 @@ in
default = []; default = [];
description = "list of path that will be synced"; 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 { 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} 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 )) (lib.strings.concatMapStrings (x: "\npath=" + x) (( if config.mods.sync.defaultSynced then defPathLst else [] ) ++ config.mods.sync.syncedAdditions ))
(if !(isNull config.mods.sync.customHostName) then "\nclientHostName=${config.mods.sync.customHostName}" else "")
]); ]);
executable = true;
}; };
} }