{ pkgs, ... }:
{
  # sudo_local is managed as a regular file by touch-id.nix because macOS 26
  # rejects nix-darwin's symlink-based /etc/pam.d management.
  security.pam.services.sudo_local.enable = false;

  networking = {
    hostName = "kanade";
    computerName = "kanade";
    localHostName = "kanade";
  };

  time.timeZone = "Asia/Seoul";

  # Keep the terminal font declared in the Ghostty Home Manager module available
  # to native macOS applications as well.
  fonts.packages = [ pkgs.nerd-fonts.jetbrains-mono ];

  system.defaults = {
    NSGlobalDomain = {
      AppleICUForce24HourTime = true;
      AppleMeasurementUnits = "Centimeters";
      AppleTemperatureUnit = "Celsius";

      AppleInterfaceStyleSwitchesAutomatically = false;
      AppleInterfaceStyle = null;

      NSAutomaticCapitalizationEnabled = false;
      NSAutomaticDashSubstitutionEnabled = false;
      NSAutomaticPeriodSubstitutionEnabled = false;
      NSAutomaticQuoteSubstitutionEnabled = false;
      NSAutomaticSpellingCorrectionEnabled = false;

      AppleShowAllExtensions = true;
      AppleShowAllFiles = true;
      NSNavPanelExpandedStateForSaveMode = true;
      NSNavPanelExpandedStateForSaveMode2 = true;
      "com.apple.sound.beep.feedback" = 0;
    };

    SoftwareUpdate = {
      AutomaticallyInstallMacOSUpdates = false;
    };

    finder = {
      AppleShowAllExtensions = true;
      FXEnableExtensionChangeWarning = false;
      FXDefaultSearchScope = "SCcf";
      FXRemoveOldTrashItems = true;
      ShowPathbar = true;
      ShowStatusBar = true;
      # _FXShowPosixPathInTitle = true;
    };

    menuExtraClock = {
      ShowAMPM = false;
      ShowDate = 1;
      ShowSeconds = false;
      Show24Hour = true;
    };

    trackpad = {
      Clicking = true;
      TrackpadRightClick = true;
      TrackpadThreeFingerDrag = true;
    };

    loginwindow.GuestEnabled = false;

    CustomUserPreferences = {
      "com.apple.AdLib" = {
        allowApplePersonalizedAdvertising = false;
      };
      "com.apple.controlcenter" = {
        BatteryShowPercentage = true;
      };
      "com.apple.desktopservices" = {
        DSDontWriteNetworkStores = true;
        DSDontWriteUSBStores = true;
      };
      "com.apple.finder"._FXSortFoldersFirst = true;
      "com.apple.screensaver" = {
        askForPassword = 1;
        askForPasswordDelay = 0;
      };
    };
  };

  system.activationScripts.postActivation.text = ''
    /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
  '';
}
