actually using unison intead of doing weird things
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
|
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/10/17 18:15:38 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";
|
ref = "master";
|
||||||
}}/themes";
|
}}/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;
|
programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,6 @@
|
|||||||
stremio
|
stremio
|
||||||
blender
|
blender
|
||||||
];
|
];
|
||||||
|
|
||||||
|
mods.sync.syncedAdditions = ["VirtualBox VMs"];
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
defPathLst = ["Desktop" "Downloads" ".mozilla"];
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.mods.sync = {
|
options.mods.sync = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "enable usr_sync command";
|
description = "setup unison";
|
||||||
};
|
};
|
||||||
|
|
||||||
homeFolder = lib.mkOption {
|
homeFolder = lib.mkOption {
|
||||||
@ -19,13 +22,28 @@
|
|||||||
default = "/raid/pc_sync";
|
default = "/raid/pc_sync";
|
||||||
description = "where on the server";
|
description = "where on the server";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultSynced = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "should it add the default paths";
|
||||||
};
|
};
|
||||||
|
|
||||||
config.home.file.".local/bin/usr_sync" = lib.mkIf config.mods.sync.enable {
|
syncedAdditions = lib.mkOption {
|
||||||
text = ''
|
type = lib.types.listOf lib.types.str;
|
||||||
#!/bin/env
|
default = [];
|
||||||
unison "${config.mods.sync.homeFolder}" "ssh://tom@tmoron.fr:1880/${config.mods.sync.destFolder}" $@
|
description = "list of path that will be synced";
|
||||||
'';
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
executable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user