From 87dce5442198eb69796b55966a780836fa48e409 Mon Sep 17 00:00:00 2001 From: olaf Date: Sat, 17 May 2025 21:20:28 +0200 Subject: [PATCH] fixing permissions because of changes postUserActivation --- apps/aarch64-darwin/build-switch | 2 +- apps/x86_64-darwin/build-switch | 2 +- hosts/darwin/default.nix | 2 +- modules/darwin/dock/default.nix | 14 ++++++++------ modules/darwin/home-manager.nix | 10 +++++----- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/apps/aarch64-darwin/build-switch b/apps/aarch64-darwin/build-switch index a83f85a..744a417 100755 --- a/apps/aarch64-darwin/build-switch +++ b/apps/aarch64-darwin/build-switch @@ -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 diff --git a/apps/x86_64-darwin/build-switch b/apps/x86_64-darwin/build-switch index 3277860..ce325c0 100644 --- a/apps/x86_64-darwin/build-switch +++ b/apps/x86_64-darwin/build-switch @@ -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 diff --git a/hosts/darwin/default.nix b/hosts/darwin/default.nix index 906aca9..aa2e3bf 100644 --- a/hosts/darwin/default.nix +++ b/hosts/darwin/default.nix @@ -84,7 +84,7 @@ in system = { stateVersion = 4; - + primaryUser = "${user}"; defaults = { NSGlobalDomain = { AppleShowAllExtensions = true; diff --git a/modules/darwin/dock/default.nix b/modules/darwin/dock/default.nix index 2fc3be3..507df23 100644 --- a/modules/darwin/dock/default.nix +++ b/modules/darwin/dock/default.nix @@ -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 } diff --git a/modules/darwin/home-manager.nix b/modules/darwin/home-manager.nix index 9a04115..0bcb20c 100644 --- a/modules/darwin/home-manager.nix +++ b/modules/darwin/home-manager.nix @@ -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"; }