fixing permissions because of changes postUserActivation

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

View File

@ -14,7 +14,7 @@ echo "${YELLOW}Starting build...${NC}"
nix --extra-experimental-features 'nix-command flakes' build .#$FLAKE_SYSTEM $@
echo "${YELLOW}Switching to new generation...${NC}"
./result/sw/bin/darwin-rebuild switch --flake .#${SYSTEM_TYPE} $@
sudo ./result/sw/bin/darwin-rebuild switch --flake .#${SYSTEM_TYPE} $@
echo "${YELLOW}Cleaning up...${NC}"
unlink ./result

View File

@ -14,7 +14,7 @@ echo "${YELLOW}Starting build...${NC}"
nix --extra-experimental-features 'nix-command flakes' build .#$FLAKE_SYSTEM $@
echo "${YELLOW}Switching to new generation...${NC}"
./result/sw/bin/darwin-rebuild switch --flake .#${SYSTEM_TYPE} $@
sudo ./result/sw/bin/darwin-rebuild switch --flake .#${SYSTEM_TYPE} $@
echo "${YELLOW}Cleaning up...${NC}"
unlink ./result

View File

@ -84,7 +84,7 @@ in
system = {
stateVersion = 4;
primaryUser = "${user}";
defaults = {
NSGlobalDomain = {
AppleShowAllExtensions = true;

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
}

View File

@ -100,7 +100,7 @@ in
{ path = "/Applications/Fantastical.app/"; }
# { path = "${pkgs.alacritty}/Applications/Alacritty.app/"; }
{ path = "/Applications/Spotify.app/"; }
{ path = "/Applications/Safari.app/"; }
{ path = "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/"; }
{ path = "/System/Applications/Photos.app/"; }
{ path = "/System/Applications/System Settings.app/"; }
{ path = "/Applications/Signal.app/"; }
@ -111,11 +111,11 @@ in
options = "-l Jellyfin";
}
{ path = "/Applications/Visual Studio Code.app/"; }
{ path = "/Applications//Home Assistant.app/"; }
{ path = "/Applications//Remarkable.app/"; }
{ path = "/Applications/Home Assistant.app/"; }
{ path = "/Applications/reMarkable.app/"; }
{ path = "/Applications/LibreOffice.app/"; }
{ path = "/Applications/Microsoft Word.app/"; }
{ path = "/Applications/Microsoft Powerpoint.app/"; }
{ path = "/Applications/Microsoft PowerPoint.app/"; }
{ path = "/Applications/Microsoft Teams.app/"; }
{ path = "/System/Applications/Utilities/Screen Sharing.app/"; }
{
@ -135,7 +135,7 @@ in
}
{
# path = "${config.users.users.${user}.home}/.local/share/downloads";
path = "${config.users.users.${user}.home}/Downloads";
path = "${config.users.users.${user}.home}/Downloads/";
section = "others";
options = "--sort name --view grid --display stack";
}