Regenerated
This commit is contained in:
+13
-6
@@ -290,26 +290,33 @@ 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, pkgs, ... }:
|
||||
{ lib, config, pkgs, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
# User information
|
||||
username = config.defaultUser or "henrov";
|
||||
homeDir = config.home.homeDirectory or "/home/${username}";
|
||||
|
||||
# Use relative path from the module file; Home Manager will expand at activation
|
||||
assetPath = builtins.toString (./../../../assets/copy_2_home);
|
||||
|
||||
# Absolute path to your assets folder
|
||||
assetPath = "${flakeRoot}/assets/copy_2_home";
|
||||
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}"
|
||||
|
||||
# Recursively copy all files, overwrite existing, preserve symlinks
|
||||
cp -a "${assetPath}/." "${homeDir}/"
|
||||
# Copy everything recursively, preserve structure, overwrite existing
|
||||
rsync -a --no-owner --no-group "${assetPath}/" "${homeDir}/"
|
||||
|
||||
echo "Done copying assets."
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user