fixing permissions because of changes postUserActivation

This commit is contained in:
2025-05-17 21:20:28 +02:00
parent 746fa7f48b
commit 87dce54421
5 changed files with 16 additions and 14 deletions

View File

@ -11,6 +11,7 @@ with lib;
let
cfg = config.local.dock;
inherit (pkgs) stdenv dockutil;
user = "olaf";
in
{
options = {
@ -77,17 +78,18 @@ in
wantURIs = concatMapStrings (entry: "${entryURI entry.path}\n") cfg.entries;
createEntries = concatMapStrings (
entry:
"if [ -e '${entry.path}' ]; then ${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options} ; fi \n "
"if [ -e '${entry.path}' ]; then ${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options} /Users/${user} ; fi \n "
) cfg.entries;
in
{
system.activationScripts.postUserActivation.text = ''
echo >&2 "Setting up the Dock..."
haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)"
if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then
system.activationScripts.postActivation.text = ''
echo >&2 "Setting up the Dock for ${user}..."
haveURIs="$(${dockutil}/bin/dockutil --list /Users/${user} | ${pkgs.coreutils}/bin/cut -f2)"
if ! diff -wu <(echo "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then
{
echo >&2 "Resetting Dock."
${dockutil}/bin/dockutil --no-restart --remove all
${dockutil}/bin/dockutil --no-restart --remove all /Users/${user}
${createEntries}
killall Dock
}