Regenerated
This commit is contained in:
+9
-11
@@ -343,20 +343,21 @@ This copies stuff to the user home-folder
|
||||
{ config, pkgs, lib, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
# Default to the configured default user
|
||||
username = config.users.users.defaultUser or "henrov";
|
||||
homeDir = "/home/${username}";
|
||||
assetPath = "${flakeRoot}/assets/copy_2_home";
|
||||
in
|
||||
{
|
||||
# Ensure rsync is available system-wide
|
||||
environment.systemPackages = [ pkgs.rsync ];
|
||||
|
||||
systemd.user.services.copyAssets = {
|
||||
description = "Copy assets to home directory";
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
# This is the proper field for commands
|
||||
# System service to copy assets to the user home at boot
|
||||
systemd.services.copyAssets = {
|
||||
description = "Copy assets to ${username}'s home directory";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
ExecStart = ''
|
||||
echo "Copying assets from ${assetPath} to ${homeDir} ..."
|
||||
|
||||
@@ -366,16 +367,13 @@ in
|
||||
fi
|
||||
|
||||
mkdir -p "${homeDir}"
|
||||
chown ${username}:${username} "${homeDir}"
|
||||
|
||||
${pkgs.rsync}/bin/rsync -a --no-owner --no-group "${assetPath}/" "${homeDir}/"
|
||||
|
||||
echo "Done copying assets."
|
||||
'';
|
||||
};
|
||||
|
||||
# Make sure the user manager is enabled for the default user
|
||||
users.users.${username}.extraGroups = [ "wheel" ]; # optional
|
||||
systemd.enableUserServices = true;
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user