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 $@ nix --extra-experimental-features 'nix-command flakes' build .#$FLAKE_SYSTEM $@
echo "${YELLOW}Switching to new generation...${NC}" 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}" echo "${YELLOW}Cleaning up...${NC}"
unlink ./result unlink ./result

View File

@ -14,7 +14,7 @@ echo "${YELLOW}Starting build...${NC}"
nix --extra-experimental-features 'nix-command flakes' build .#$FLAKE_SYSTEM $@ nix --extra-experimental-features 'nix-command flakes' build .#$FLAKE_SYSTEM $@
echo "${YELLOW}Switching to new generation...${NC}" 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}" echo "${YELLOW}Cleaning up...${NC}"
unlink ./result unlink ./result

View File

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

View File

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

View File

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