Regenerated
This commit is contained in:
+21
-31
@@ -276,7 +276,7 @@ in {
|
||||
device = "nodev";
|
||||
useOSProber = true;
|
||||
};
|
||||
#boot.efi.canTouchEfiVariables = true;
|
||||
boot.efi.canTouchEfiVariables = true;
|
||||
|
||||
boot.kernelParams = [
|
||||
"systemd.mask=dev-tpm0.device"
|
||||
@@ -294,41 +294,31 @@ This copies stuff to the user home-folder
|
||||
|
||||
let
|
||||
username = config.defaultUser or "henrov";
|
||||
|
||||
# Base home directory
|
||||
homeDir = config.home.homeDirectory or "/home/${username}";
|
||||
|
||||
# Absolute path to assets
|
||||
homeDir = config.home.homeDirectory or "/home/${username}";
|
||||
assetPath = "${flakeRoot}/assets/copy_2_home";
|
||||
|
||||
# Helper: recursively list all files and their relative paths
|
||||
recursiveFiles = path:
|
||||
let
|
||||
entries = builtins.attrNames (builtins.readDir path);
|
||||
in
|
||||
lib.concatMap (name:
|
||||
let full = "${path}/${name}";
|
||||
in if builtins.isDir full
|
||||
then map (sub: "${name}/${sub}") (recursiveFiles full)
|
||||
else [ name ]
|
||||
) entries;
|
||||
|
||||
allFiles = recursiveFiles assetPath;
|
||||
|
||||
# Map each file to a home.file entry
|
||||
homeFiles = lib.genAttrs allFiles (relativePath: {
|
||||
name = relativePath;
|
||||
value = {
|
||||
source = "${assetPath}/${relativePath}";
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
_module.args.hmUsers = {
|
||||
${username} = {
|
||||
home.file = lib.mkMerge [
|
||||
homeFiles
|
||||
];
|
||||
# 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."
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user