From dee253cf563a515e3d7f04ad2e03491f2b4092ee Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 11 Jan 2025 15:44:41 +0000 Subject: [PATCH] applications: use `system.primaryUser` for the legacy path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit System activation scripts shouldn’t (and soon won’t be able to) rely on `$HOME` being the primary user’s. --- modules/system/applications.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/system/applications.nix b/modules/system/applications.nix index 9dd87665..a2277c7a 100644 --- a/modules/system/applications.nix +++ b/modules/system/applications.nix @@ -30,12 +30,15 @@ in [ -L "$1" ] && [ "''${link#*-}" = 'system-applications/Applications' ] } - # Clean up for links created at the old location in HOME - if ourLink ~/Applications; then - rm ~/Applications - elif ourLink ~/Applications/'Nix Apps'; then - rm ~/Applications/'Nix Apps' - fi + ${lib.optionalString (config.system.primaryUser != null) '' + # Clean up for links created at the old location in HOME + # TODO: Remove this in 25.11. + if ourLink ~${config.system.primaryUser}/Applications; then + rm ~${config.system.primaryUser}/Applications + elif ourLink ~${config.system.primaryUser}/Applications/'Nix Apps'; then + rm ~${config.system.primaryUser}/Applications/'Nix Apps' + fi + ''} if [ ! -e '/Applications/Nix Apps' ] \ || ourLink '/Applications/Nix Apps'; then