Regenerated
This commit is contained in:
+11
-11
@@ -2,14 +2,14 @@
|
||||
|
||||
let
|
||||
username = config.users.users.defaultUser or "henrov";
|
||||
homeDir = "/home/${username}";
|
||||
assetPath = "${flakeRoot}/assets/copy_2_home";
|
||||
configDir = "/home/${username}/.config";
|
||||
assetPath = "${flakeRoot}/.config";
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ pkgs.rsync ];
|
||||
|
||||
systemd.services.copyAssets = {
|
||||
description = "Copy assets to ${username}'s home directory";
|
||||
description = "Copy assets to ${username}'s .config directory";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# oneshot service runs once at boot
|
||||
@@ -18,24 +18,24 @@ in
|
||||
# Always use /bin/sh -c for multi-line commands
|
||||
serviceConfig.ExecStart = ''
|
||||
/bin/sh -c '
|
||||
echo "Copying assets from ${assetPath} to ${homeDir}/Droidnix ..."
|
||||
echo "Copying assets from ${assetPath} to ${configDir} ..."
|
||||
|
||||
if [ ! -d "${assetPath}" ]; then
|
||||
echo "ERROR: ${assetPath} does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${homeDir}/Droidnix"
|
||||
chown u+rwx ${username}:${username} "${homeDir}/Droidnix"
|
||||
mkdir -p "${configDir}"
|
||||
chown -R u+rwx ${username}:${username} "${configDir}"
|
||||
|
||||
${pkgs.rsync}/bin/rsync -a --no-owner --no-group "${assetPath}/" "${homeDir}/"
|
||||
${pkgs.rsync}/bin/rsync -a --no-owner --no-group "${assetPath}/" "${configDir}/"
|
||||
|
||||
# Fix .config permissions
|
||||
mkdir -p "${homeDir}/.config"
|
||||
chown -R ${username}:${username} "${homeDir}/.config"
|
||||
chmod u+rwx "${homeDir}/.config"
|
||||
mkdir -p "${configDir}"
|
||||
chown -R ${username}:${username} "${configDir}"
|
||||
chmod -R u+rwx "${configDir}"
|
||||
|
||||
echo "Done copying assets."
|
||||
echo "Done copying config files."
|
||||
'
|
||||
'';
|
||||
};
|
||||
Reference in New Issue
Block a user