Regenerated

This commit is contained in:
2026-03-22 09:07:26 +00:00
parent 487736ed17
commit 244bba45d2
32 changed files with 29 additions and 1553 deletions
+29 -19
View File
@@ -293,33 +293,43 @@ This copies stuff to the user home-folder
{ lib, config, pkgs, flakeRoot, ... }:
let
# User information
username = config.defaultUser or "henrov";
homeDir = config.home.homeDirectory or "/home/${username}";
# Absolute path to your assets folder
# Absolute path to the assets folder
assetPath = "${flakeRoot}/assets/copy_2_home";
# Helper function to recursively list files in a directory
recursiveFiles = path:
let
entries = builtins.attrNames (builtins.readDir path);
in
lib.concatMap (name:
let
full = "${path}/${name}";
in
if builtins.isDir full
then recursiveFiles full
else [ full ]
) entries;
# All files in assets folder
allFiles = recursiveFiles assetPath;
# Map files to home.file entries
homeFiles = lib.genAttrs allFiles (f: let
relative = lib.replaceStrings [ "${assetPath}/" ] [ "" ] f;
in {
name = relative;
value = { source = f; };
});
in
{
_module.args.hmUsers = {
${username} = {
# 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
# Ensure home directory exists
mkdir -p "${homeDir}"
# Copy everything recursively, preserve structure, overwrite existing
rsync -a --no-owner --no-group "${assetPath}/" "${homeDir}/"
echo "Done copying assets."
'';
home.file = lib.mkMerge [
homeFiles
];
};
};
}