Regenerated
This commit is contained in:
+19
-18
@@ -287,31 +287,32 @@ 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";
|
||||
|
||||
# Include the source folder in the Nix store
|
||||
assetPath = builtins.path { path = ../../../assets/copy_2_home; };
|
||||
assetPath = ../../../assets/copy_2_home;
|
||||
|
||||
# readDir gives all entries in the folder
|
||||
entries = builtins.readDir assetPath;
|
||||
|
||||
# generate xdg-style home.file entries
|
||||
homeFiles = lib.genAttrs (builtins.attrNames entries) (name: {
|
||||
# source path in store
|
||||
source = "${assetPath}/${name}";
|
||||
});
|
||||
in
|
||||
{
|
||||
_module.args.hmUsers = {
|
||||
# Ensure this user entry merges safely with other modules
|
||||
${username} = lib.mkMerge [
|
||||
# Any previous _module.args.hmUsers.${username} entries from other modules will merge automatically
|
||||
{
|
||||
# Activation script to copy all assets into $HOME
|
||||
home.activation.copyAssets = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
echo "Copying assets from ${assetPath} to home directory..."
|
||||
|
||||
# Copy recursively, overwrite existing files, leave other files untouched
|
||||
cp -rT ${assetPath} "$HOME"
|
||||
|
||||
echo "Done copying assets."
|
||||
'';
|
||||
}
|
||||
];
|
||||
${username} = {
|
||||
# recursively copy all files under the top-level folder into home
|
||||
home.file = lib.mkMerge (map (name: {
|
||||
# target path in home
|
||||
name = name;
|
||||
value = { source = "${assetPath}/${name}"; };
|
||||
}) (builtins.attrNames entries));
|
||||
};
|
||||
};
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
Reference in New Issue
Block a user