Regenerated

This commit is contained in:
2026-03-22 07:38:15 +00:00
parent 5bc6ea37d1
commit b64db79a2e
32 changed files with 11 additions and 1573 deletions
+11 -30
View File
@@ -287,45 +287,26 @@ in {
** =generated/modules/users/copy_2_home.nix=
This copies stuff to the user home-folder
#+BEGIN_SRC nix :tangle generated/modules/users/copy_2_home.nix :noweb tangle :mkdirp yes :eval never-html
{ lib, config, ... }:
{ lib, config, pkgs, ... }:
let
username = config.defaultUser or "henrov";
# Absolute path to assets folder
# Absolute path to your assets folder
assetPath = ../../../assets/copy_2_home;
# Helper: recursively list all files in assetPath
recursiveListFiles = path:
let
entries = builtins.attrNames (builtins.readDir path);
in
lib.concatMap (name:
let full = "${path}/${name}"; in
if builtins.isDir full
then recursiveListFiles full
else [ full ]
) entries;
# All files in the folder (full paths)
allFiles = recursiveListFiles assetPath;
# Map each file to a home.file entry
homeFiles = lib.genAttrs allFiles (f: {
# Compute relative path from assetPath
relative = lib.strings.replaceStrings [ "${assetPath}/" ] [ "" ] f;
name = relative; # target path in $HOME
value = { source = f; }; # source path
});
in
{
_module.args.hmUsers = {
${username} = {
# Merge with other modules safely
home.file = lib.mkMerge [
homeFiles
];
# Activation script: run after Home Manager writes everything else
home.activation.copyAssets = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
echo "Copying assets from ${assetPath} to home directory..."
# Recursively copy all files and directories, overwrite existing files
rsync -a --delete "${assetPath}/" "$HOME/"
echo "Done copying assets."
'';
};
};
}