33 lines
919 B
Nix
33 lines
919 B
Nix
{ lib, config, pkgs, flakeRoot, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
homeDir = config.home.homeDirectory or "/home/${username}";
|
|
assetPath = "${flakeRoot}/assets/copy_2_home";
|
|
in
|
|
{
|
|
_module.args.hmUsers = {
|
|
${username} = {
|
|
# Make rsync available for the activation script
|
|
home.packages = [ pkgs.rsync ];
|
|
|
|
# Activation script runs after everything else
|
|
home.activation.copyAssets = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
echo "Copying assets from ${assetPath} to ${homeDir} ..."
|
|
|
|
if [ ! -d "${assetPath}" ]; then
|
|
echo "Error: source directory ${assetPath} does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "${homeDir}"
|
|
|
|
# Copy recursively, overwrite existing files, preserve symlinks
|
|
rsync -a --no-owner --no-group "${assetPath}/" "${homeDir}/"
|
|
|
|
echo "Done copying assets."
|
|
'';
|
|
};
|
|
};
|
|
}
|