From 849ecfd6b7f588185e06ddb49e1f8ea1b806a695 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Fri, 14 Jul 2023 10:35:06 +0800 Subject: [PATCH] fix: customize macOS, fix alacritty --- home/darwin/alacritty/alacritty.yml | 2 +- home/linux/desktop/alacritty/alacritty.yml | 2 +- modules/darwin/apps.nix | 92 +++++++++++++++++----- modules/darwin/core.nix | 14 +++- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/home/darwin/alacritty/alacritty.yml b/home/darwin/alacritty/alacritty.yml index f4595b5a..975e7f98 100644 --- a/home/darwin/alacritty/alacritty.yml +++ b/home/darwin/alacritty/alacritty.yml @@ -278,7 +278,7 @@ shell: # # Directory the shell is started in. If this is unset, or `None`, the working # directory of the parent process will be used. -working_directory: ~/codes/ +#working_directory: None # Offer IPC using `alacritty msg` (unix only) #ipc_socket: true diff --git a/home/linux/desktop/alacritty/alacritty.yml b/home/linux/desktop/alacritty/alacritty.yml index 1f480ba9..9745d348 100644 --- a/home/linux/desktop/alacritty/alacritty.yml +++ b/home/linux/desktop/alacritty/alacritty.yml @@ -278,7 +278,7 @@ live_config_reload: true # # Directory the shell is started in. If this is unset, or `None`, the working # directory of the parent process will be used. -working_directory: ~/codes/ +#working_directory: None # Offer IPC using `alacritty msg` (unix only) #ipc_socket: true diff --git a/modules/darwin/apps.nix b/modules/darwin/apps.nix index 08cf4c9c..b8537bfb 100644 --- a/modules/darwin/apps.nix +++ b/modules/darwin/apps.nix @@ -11,18 +11,60 @@ system = { defaults = { + # customize dock dock = { autohide = true; + show-recents = false; # disable recent apps + + # customize Hot Corners(触发角, 鼠标移动到屏幕角落时触发的动作) + wvous-tl-corner = 2; # Mission Control + wvous-tr-corner = 13; # Lock Screen + wvous-bl-corner = 3; # Application Windows + wvous-br-corner = 4; # Desktop }; + # customize finder finder = { - _FXShowPosixPathInTitle = false; + _FXShowPosixPathInTitle = true; # show full path in finder title + AppleShowAllExtensions = true; # show all file extensions + FXEnableExtensionChangeWarning = false; # disable warning when changing file extension + QuitMenuItem = true; # enable quit menu item + ShowPathbar = true; # show path bar + ShowStatusBar = true; # show status bar + }; + + # customize trackpad + trackpad = { + Clicking = true; # enable tap to click + Dragging = true; # enable tap to drag + TrackpadRightClick = true; # enable two finger right click + TrackpadThreeFingerDrag = true; # enable three finger drag + }; + + # customize macOS + NSGlobalDomain = { + "com.apple.swipescrolldirection" = true; # enable natural scrolling + "com.apple.sound.beep.feedback" = 0; # disable beep sound when pressing volume up/down key + AppleInterfaceStyle = "Dark"; # dark mode + AppleKeyboardUIMode = 3; # Mode 3 enables full keyboard control. + ApplePressAndHoldEnabled = true; # enable press and hold + NSAutomaticCapitalizationEnabled = false; # disable auto capitalization(自动大写) + NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution(智能破折号替换) + NSAutomaticPeriodSubstitutionEnabled = false; # disable auto period substitution(智能句号替换) + NSAutomaticQuoteSubstitutionEnabled = false; # disable auto quote substitution(智能引号替换) + NSAutomaticSpellingCorrectionEnabled = false; # disable auto spelling correction(自动拼写检查) + NSNavPanelExpandedStateForSaveMode = true; # expand save panel by default(保存文件时的路径选择/文件名输入页) + NSNavPanelExpandedStateForSaveMode2 = true; }; }; + # keyboard settings is not very useful on macOS + # the most important thing is to remap option key to alt key globally, + # but it's not supported by macOS yet. keyboard = { - enableKeyMapping = true; - remapCapsLockToControl = true; + enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` + remapCapsLockToControl = false; # remap caps lock to control + remapCapsLockToEscape = false; # remap caps lock to escape }; }; @@ -35,6 +77,11 @@ cleanup = "zap"; }; + # Applications to install from Mac App Store using mas. + masApps = { + # Xcode = 497799835; + }; + taps = [ "homebrew/cask" "homebrew/cask-fonts" @@ -47,21 +94,23 @@ brews = [ # `brew install` - "wget" + "wget" # download tool "curl" # no not install curl via nixpkgs, it's not working well on macOS! - "aria2" - "httpie" - "wireguard-tools" - "tailscale" + "aria2" # download tool + "httpie" # http client + "wireguard-tools" # wireguard + "tailscale" # tailscale ]; # `brew install --cask` casks = [ + # broser & editor "firefox" "google-chrome" "visual-studio-code" "visual-studio-code-insiders" + # IM & audio & remote desktop & meeting "telegram" "discord" "wechat" @@ -73,20 +122,21 @@ "tencent-meeting" # "anki" - "clashx" - "iina" - "openinterminal-lite" - "syncthing" - "raycast" - "iglance" - "eudic" + "clashx" # proxy tool + "iina" # video player + "openinterminal-lite" # open current folder in terminal + "syncthing" # file sync + "raycast" # Alfred-like tool(search and run scripts) + "iglance" # beautiful system monitor + "eudic" # 欧路词典 "baiduinput" # baidu input method - # "reaper" + # "reaper" # audio editor - "insomnia" - "wireshark" - "jdk-mission-control" - "google-cloud-sdk" + # Development + "insomnia" # REST client + "wireshark" # network analyzer + "jdk-mission-control" # Java Mission Control + "google-cloud-sdk" # Google Cloud SDK ]; }; -} \ No newline at end of file +} diff --git a/modules/darwin/core.nix b/modules/darwin/core.nix index 7f6de620..15f83e8d 100644 --- a/modules/darwin/core.nix +++ b/modules/darwin/core.nix @@ -10,7 +10,8 @@ # ################################################################################### - # # enable flakes globally + + # enable flakes globally nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.trusted-users = ["admin"]; @@ -28,6 +29,17 @@ programs.nix-index.enable = true; + # boot.loader.grub.configurationLimit = 10; + # do garbage collection weekly to keep disk usage low + nix.gc = { + automatic = lib.mkDefault true; + options = lib.mkDefault "--delete-older-than 1w"; + }; + + # Manual optimise storage: nix-store --optimise + # https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store + nix.settings.auto-optimise-store = true; + # Add ability to used TouchID for sudo authentication security.pam.enableSudoTouchIdAuth = true;