Harald Hoyer
6e5fef359d
Moved the system defaults configuration block to follow the system activation script definition. This change organizes the code better, improving readability and maintainability.
50 lines
1.2 KiB
Nix
50 lines
1.2 KiB
Nix
{ options, config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
with lib.metacfg;
|
|
let cfg = config.metacfg.system.interface;
|
|
in
|
|
{
|
|
options.metacfg.system.interface = with types; {
|
|
enable = mkEnableOption "macOS interface";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
system.activationScripts.applications.text = let
|
|
env = pkgs.buildEnv {
|
|
name = "system-applications";
|
|
paths = config.environment.systemPackages;
|
|
pathsToLink = "/Applications";
|
|
};
|
|
in
|
|
lib.mkForce ''
|
|
# Set up applications.
|
|
echo "setting up /Applications..." >&2
|
|
rm -rf /Applications/Nix\ Apps
|
|
mkdir -p /Applications/Nix\ Apps
|
|
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
|
|
while read -r src; do
|
|
app_name=$(basename "$src")
|
|
echo "copying $src" >&2
|
|
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
|
|
done
|
|
'';
|
|
|
|
system.defaults = {
|
|
dock.autohide = true;
|
|
|
|
finder = {
|
|
AppleShowAllExtensions = true;
|
|
FXEnableExtensionChangeWarning = false;
|
|
};
|
|
|
|
NSGlobalDomain = {
|
|
_HIHideMenuBar = true;
|
|
AppleShowScrollBars = "Always";
|
|
};
|
|
};
|
|
|
|
metacfg.home.file.".hushlogin".text = "";
|
|
};
|
|
}
|