diff --git a/modules/assets.nix b/modules/assets.nix index 770d971..c14acb7 100644 --- a/modules/assets.nix +++ b/modules/assets.nix @@ -1,24 +1,14 @@ { config, pkgs, lib, ... }: let + settings = import ../settings.nix; # The assets folder from the project root assetsPath = ../assets; in { - systemd.user.services.sync-assets = { - description = "Sync assets to home directory"; - wantedBy = [ "graphical-session.target" ]; - partOf = [ "graphical-session.target" ]; - script = '' - # Remove existing Assets directory or symlink - ${pkgs.coreutils}/bin/rm -rf %h/Assets - - # Create symbolic link to the assets in the Nix store - ${pkgs.coreutils}/bin/ln -s ${assetsPath} %h/Assets - ''; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - }; + # Use tmpfiles.rules to create the symlink at boot/activation + # L+ forces the creation of the symlink, removing existing file/dir if necessary + systemd.tmpfiles.rules = [ + "L+ /home/${settings.username}/Assets - - - - ${assetsPath}" + ]; }