From 5572f3bd3a401405215d4d2b863dfeb0f198812d Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 5 Mar 2025 00:18:51 -0500 Subject: home/arkenfox: finally fix prefsCleaner.sh execution --- modules/home/arkenfox/default.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'modules/home/arkenfox') diff --git a/modules/home/arkenfox/default.nix b/modules/home/arkenfox/default.nix index 4c4bdca..a6f0061 100644 --- a/modules/home/arkenfox/default.nix +++ b/modules/home/arkenfox/default.nix @@ -99,16 +99,23 @@ in ''; onChange = '' - cd ${config.home.homeDirectory}/${dirOf prefsCleanerPath} - - if [[ -f prefs.js ]]; then - run --quiet ${config.home.homeDirectory}/${prefsCleanerPath} -d -s + if [[ -f ${config.home.homeDirectory}/${dirOf prefsCleanerPath}/prefs.js ]]; then + ${config.home.homeDirectory}/${prefsCleanerPath} -d -s fi ''; }; ${prefsCleanerPath} = lib.mkIf profile.arkenfox.enable { - source = profile.arkenfox.source + "/prefsCleaner.sh"; + # Make sure the script doesn't traverse symlinks, else it'll end up trying to write to the store + source = pkgs.runCommand "home-manager-firefox-profile-${profile.name}-prefs-cleaner" { } '' + cp ${profile.arkenfox.source + "/prefsCleaner.sh"} $out + chmod +w $out + substituteInPlace $out \ + --replace-fail \ + 'SCRIPT_FILE=$(readlink -f "''${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "''${BASH_SOURCE[0]}" 2>/dev/null)' \ + 'SCRIPT_FILE="''${BASH_SOURCE[0]}"' + ''; + executable = true; }; } -- cgit v1.2.3