refactor: reorder system defaults after activation script

Moved the system defaults configuration block to follow the system activation script definition. This change organizes the code better, improving readability and maintainability.
This commit is contained in:
Harald Hoyer 2024-11-18 15:20:40 +01:00
parent 4cbfc5bd94
commit 6e5fef359d

View file

@ -10,9 +10,6 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
system.defaults = {
dock.autohide = true;
system.activationScripts.applications.text = let system.activationScripts.applications.text = let
env = pkgs.buildEnv { env = pkgs.buildEnv {
name = "system-applications"; name = "system-applications";
@ -20,19 +17,22 @@ in
pathsToLink = "/Applications"; pathsToLink = "/Applications";
}; };
in in
pkgs.lib.mkForce '' lib.mkForce ''
# Set up applications. # Set up applications.
echo "setting up /Applications..." >&2 echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read src; do while read -r src; do
app_name=$(basename "$src") app_name=$(basename "$src")
echo "copying $src" >&2 echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done done
''; '';
system.defaults = {
dock.autohide = true;
finder = { finder = {
AppleShowAllExtensions = true; AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = false; FXEnableExtensionChangeWarning = false;