From 0f8fe62245ee63a0ac1193791267cdc47ea2cf70 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Fri, 24 Oct 2025 12:46:00 +0200 Subject: [PATCH] remove macos and nix-darwin related config --- README.md | 14 +-- flake.lock | 94 +++------------- flake.nix | 31 +----- hosts/darwin/home-default.nix | 191 -------------------------------- hosts/darwin/imac/home.nix | 16 --- hosts/darwin/imac/system.nix | 12 -- hosts/darwin/mba/home.nix | 16 --- hosts/darwin/mba/system.nix | 12 -- hosts/darwin/system-default.nix | 159 -------------------------- modules/homebrew.nix | 44 -------- modules/lazygit.nix | 4 +- modules/nvim.nix | 73 +++++------- modules/papis.nix | 21 ++-- modules/rsync.nix | 8 +- modules/syncthing.nix | 5 - modules/termscp.nix | 2 +- 16 files changed, 62 insertions(+), 640 deletions(-) delete mode 100644 hosts/darwin/home-default.nix delete mode 100644 hosts/darwin/imac/home.nix delete mode 100644 hosts/darwin/imac/system.nix delete mode 100644 hosts/darwin/mba/home.nix delete mode 100644 hosts/darwin/mba/system.nix delete mode 100644 hosts/darwin/system-default.nix delete mode 100644 modules/homebrew.nix diff --git a/README.md b/README.md index 2eda7b4..194dada 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Nix Configuration -Flake-based NixOS and nix-darwin configuration with home-manager. +Flake-based NixOS configuration with home-manager. ## Commands ### Daily Use ```bash # System rebuild -sudo darwin-rebuild switch --flake .# # macOS -sudo nixos-rebuild switch --flake .# # NixOS +sudo nixos-rebuild switch --flake .# # or use alias: oss # Home Manager @@ -35,11 +34,9 @@ nix search nixpkgs # Rollback sudo nixos-rebuild switch --rollback -sudo darwin-rebuild switch --rollback # Build without switching nixos-rebuild build --flake .# -darwin-rebuild build --flake .# ``` ## Structure @@ -48,10 +45,6 @@ darwin-rebuild build --flake .# . ├── flake.nix # Entry point ├── hosts/ -│ ├── darwin/ # macOS configurations -│ │ ├── system-default.nix -│ │ ├── home-default.nix -│ │ └── / │ └── nixos/ # NixOS configurations │ ├── system-default.nix │ ├── home-default.nix @@ -73,7 +66,6 @@ Modules are self-contained and handle both package installation and configuratio - `firefox.nix` - Browser with extensions and bookmarks - `ghostty.nix` - GPU-accelerated terminal emulator - `git.nix` - Version control with aliases -- `homebrew.nix` - macOS package management - `lazygit.nix` - Terminal UI for git - `login-display.nix` - SSH login display with system/disk info - `nvim.nix` - Neovim editor configuration @@ -104,7 +96,7 @@ Modules are self-contained and handle both package installation and configuratio ### Quick Aliases - `hms` - Rebuild home-manager -- `oss` - Rebuild system (works on both Darwin/NixOS) +- `oss` - Rebuild NixOS system - `cdf` - Interactive file search with cd - `pwdf` - Get file path interactively - `zi` - Interactive zoxide with fzf diff --git a/flake.lock b/flake.lock index 9555738..cbc2d40 100644 --- a/flake.lock +++ b/flake.lock @@ -1,33 +1,16 @@ { "nodes": { - "brew-src": { - "flake": false, - "locked": { - "lastModified": 1758543057, - "narHash": "sha256-lw3V2jOGYphUFHYQ5oARcb6urlbNpUCLJy1qhsGdUmc=", - "owner": "Homebrew", - "repo": "brew", - "rev": "5b236456eb93133c2bd0d60ef35ed63f1c0712f6", - "type": "github" - }, - "original": { - "owner": "Homebrew", - "ref": "4.6.12", - "repo": "brew", - "type": "github" - } - }, "claude-code": { "inputs": { "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1761084137, - "narHash": "sha256-TnwqkQX1k2dTWtdO8TXqQPY2h+f4Hs+nz2LvCRzENDw=", + "lastModified": 1761260509, + "narHash": "sha256-ZI1D+GEGBQW0JMDc5ynznjeZmXU2l65LrISdFsUeYn8=", "owner": "sadjow", "repo": "claude-code-nix", - "rev": "32717b29890ae8933bc43e520725d076112e574a", + "rev": "88db4ca53f200b692514d1d20c265f91e98ead90", "type": "github" }, "original": { @@ -64,11 +47,11 @@ }, "locked": { "dir": "pkgs/firefox-addons", - "lastModified": 1761192212, - "narHash": "sha256-X3vyI+bD9bC5Yqpxv+ENPa20k+nTF4a8Xc+YGDYmQNY=", + "lastModified": 1761278620, + "narHash": "sha256-wXblionelTRI2Bpiigez6UpCiz+760ItWHeXcrQA2cE=", "owner": "rycee", "repo": "nur-expressions", - "rev": "f7cb4f5b05fd542a7c2b6d612b6340c3c59f1314", + "rev": "de5552e6036ecfdf1cab325bf17b3c9040869d45", "type": "gitlab" }, "original": { @@ -142,11 +125,11 @@ ] }, "locked": { - "lastModified": 1761235135, - "narHash": "sha256-cux9xeceLIER1lBxUa1gMafkz7gg5ntcUmJBynWdBWI=", + "lastModified": 1761266473, + "narHash": "sha256-QxCyKWBmuzI+eMhYV1JmbZsiUnBNATRP1EW34OBt5Vg=", "owner": "nix-community", "repo": "home-manager", - "rev": "0adf9ba3f567da2d53af581a857aacf671aaa547", + "rev": "5c71d4a730bd3c972befff343bb074421e345937", "type": "github" }, "original": { @@ -183,52 +166,13 @@ "type": "github" } }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1760721282, - "narHash": "sha256-aAHphQbU9t/b2RRy2Eb8oMv+I08isXv2KUGFAFn7nCo=", - "owner": "nix-darwin", - "repo": "nix-darwin", - "rev": "c3211fcd0c56c11ff110d346d4487b18f7365168", - "type": "github" - }, - "original": { - "owner": "nix-darwin", - "ref": "master", - "repo": "nix-darwin", - "type": "github" - } - }, - "nix-homebrew": { - "inputs": { - "brew-src": "brew-src" - }, - "locked": { - "lastModified": 1758598228, - "narHash": "sha256-qr60maXGbZ4FX5tejPRI3nr0bnRTnZ3AbbbfO6/6jq4=", - "owner": "zhaofengli", - "repo": "nix-homebrew", - "rev": "f36e5db56e117f7df701ab152d0d2036ea85218c", - "type": "github" - }, - "original": { - "owner": "zhaofengli", - "repo": "nix-homebrew", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1760965567, - "narHash": "sha256-0JDOal5P7xzzAibvD0yTE3ptyvoVOAL0rcELmDdtSKg=", + "lastModified": 1761166759, + "narHash": "sha256-DTTTjEVRxEBLHoiCJ2xZL+IOZ7Vw2PnnGintfZt16QM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cb82756ecc37fa623f8cf3e88854f9bf7f64af93", + "rev": "01b6809f7f9d1183a2b3e081f0a1e6f8f415cb09", "type": "github" }, "original": { @@ -240,11 +184,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1760965567, - "narHash": "sha256-0JDOal5P7xzzAibvD0yTE3ptyvoVOAL0rcELmDdtSKg=", + "lastModified": 1761236834, + "narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cb82756ecc37fa623f8cf3e88854f9bf7f64af93", + "rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1", "type": "github" }, "original": { @@ -264,11 +208,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1761222236, - "narHash": "sha256-Um296vYIWjSjm4btukpjyVPLIz5ovQgoAtEYXFb/Jr4=", + "lastModified": 1761301697, + "narHash": "sha256-mfxQ6FwEBb5Z7oMJ8C9jVSAabx2BIx1B8/byenJdwIE=", "owner": "nix-community", "repo": "nixvim", - "rev": "39443b9f5737b6f8ee0b654eb47d3a64daac1bd0", + "rev": "ecb75f49d10fe2823b0822e4e95e53f80e426742", "type": "github" }, "original": { @@ -306,8 +250,6 @@ "disko": "disko", "firefox-addons": "firefox-addons", "home-manager": "home-manager", - "nix-darwin": "nix-darwin", - "nix-homebrew": "nix-homebrew", "nixpkgs": "nixpkgs_2", "nixvim": "nixvim" } diff --git a/flake.nix b/flake.nix index e428aef..5dbd812 100644 --- a/flake.nix +++ b/flake.nix @@ -3,8 +3,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nix-darwin.url = "github:nix-darwin/nix-darwin/master"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; nixvim.url = "github:nix-community/nixvim"; @@ -14,27 +12,12 @@ url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; }; - nix-homebrew.url = "github:zhaofengli/nix-homebrew"; disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, nix-homebrew, disko }: + outputs = inputs@{ self, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, disko }: { - darwinConfigurations."mba" = nix-darwin.lib.darwinSystem { - modules = [ - ./hosts/darwin/mba/system.nix - ]; - specialArgs = { inherit nix-homebrew; }; - }; - - darwinConfigurations."imac" = nix-darwin.lib.darwinSystem { - modules = [ - ./hosts/darwin/imac/system.nix - ]; - specialArgs = { inherit nix-homebrew; }; - }; - nixosConfigurations."hs" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ @@ -61,18 +44,6 @@ }; homeConfigurations = { - "yanlin@mba" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-darwin; - modules = [ ./hosts/darwin/mba/home.nix ]; - extraSpecialArgs = { inherit claude-code nixvim firefox-addons; }; - }; - - "yanlin@imac" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-darwin; - modules = [ ./hosts/darwin/imac/home.nix ]; - extraSpecialArgs = { inherit claude-code nixvim firefox-addons; }; - }; - "yanlin@hs" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; modules = [ ./hosts/nixos/hs/home.nix ]; diff --git a/hosts/darwin/home-default.nix b/hosts/darwin/home-default.nix deleted file mode 100644 index 0284bd8..0000000 --- a/hosts/darwin/home-default.nix +++ /dev/null @@ -1,191 +0,0 @@ -{ config, pkgs, nixvim, claude-code, firefox-addons, ... }: - -{ - imports = [ - nixvim.homeModules.nixvim - ../../modules/nvim.nix - ../../modules/tmux.nix - ../../modules/zsh.nix - ../../modules/ssh.nix - ../../modules/git.nix - ../../modules/lazygit.nix - ../../modules/papis.nix - ../../modules/termscp.nix - ../../modules/rsync.nix - ../../modules/btop.nix - ../../modules/firefox.nix - ../../modules/ghostty.nix - ../../modules/syncthing.nix - ../../modules/dictionary.nix - ../../modules/yt-dlp.nix - ../../modules/claude-code.nix - ../../modules/tex.nix - ../../config/fonts.nix - ]; - - nixpkgs.config.allowUnfree = true; - - # Firefox configuration - programs.firefox-custom = { - enable = true; - package = null; # Use system Firefox on Darwin - }; - - # Ghostty configuration - programs.ghostty-custom = { - enable = true; - package = null; # Use Homebrew-installed Ghostty on Darwin - windowMode = "windowed"; - windowWidth = 999; - windowHeight = 999; - }; - - # Claude Code configuration - programs.claude-code-custom = { - enable = true; - }; - - home.username = "yanlin"; - home.homeDirectory = "/Users/yanlin"; - home.stateVersion = "24.05"; - - programs.home-manager.enable = true; - - # darwin-specific alias - programs.zsh.shellAliases = { - oss = "sudo darwin-rebuild switch --flake ~/.config/nix#$(hostname)"; - - preview = "open -a Preview"; - slide = "open -a SlidePilot"; - - # Network monitoring aliases - bw = "sudo bandwhich"; - bw-raw = "sudo bandwhich --raw"; - bw-dns = "sudo bandwhich --show-dns"; - }; - - # Darwin-specific zsh functions - programs.zsh.initContent = '' - # Function to search and open all macOS applications - function app() { - local app_path - local file_to_open="$1" - - app_path=$( (find -L /Applications -name "*.app" -maxdepth 2 2>/dev/null; \ - find -L ~/Applications -name "*.app" -maxdepth 3 2>/dev/null; \ - find /System/Applications -name "*.app" -maxdepth 2 2>/dev/null; \ - find /System/Applications/Utilities -name "*.app" -maxdepth 1 2>/dev/null) | - sort | uniq | - fzf --header="Select app to open''${file_to_open:+ file: $file_to_open}" \ - --preview 'basename {} .app' \ - --preview-window=up:1 \ - --height=40%) - - if [[ -n "$app_path" ]]; then - if [[ -n "$file_to_open" ]]; then - open -a "$app_path" "$file_to_open" - else - open "$app_path" - fi - fi - } - - # SSH tunnel functions for easy VPN-like functionality - function tunnel-on() { - if [[ -z "$1" ]]; then - echo "Usage: tunnel-on " - return 1 - fi - - local host="$1" - local port=1080 # Use port 1080 (standard SOCKS port) - - # Check if there's already an active tunnel - local existing_tunnel=$(ps aux | grep -E "ssh -D $port" | grep -v grep) - if [[ -n "$existing_tunnel" ]]; then - echo "Existing tunnel detected. Switching to $host..." - echo "Stopping current tunnel..." - pkill -f "ssh -D $port" - sleep 1 - fi - - echo "Starting SOCKS tunnel to $host on port $port..." - - # Start SSH tunnel in background - ssh -D $port -N -f "$host" - if [[ $? -eq 0 ]]; then - echo "Tunnel established. Configuring system proxy..." - - # Configure system proxy - networksetup -setsocksfirewallproxy "Wi-Fi" localhost $port - networksetup -setsocksfirewallproxystate "Wi-Fi" on - - echo "✓ System proxy enabled on Wi-Fi (localhost:$port -> $host)" - else - echo "✗ Failed to establish tunnel to $host" - return 1 - fi - } - - function tunnel-off() { - local port=1080 - echo "Disabling system proxy..." - networksetup -setsocksfirewallproxystate "Wi-Fi" off - echo "✓ System proxy disabled" - - echo "Stopping SSH tunnels..." - pkill -f "ssh -D $port" - echo "✓ SSH tunnels stopped" - } - - function tunnel-status() { - local port=1080 - echo "=== System Proxy Status ===" - networksetup -getsocksfirewallproxy "Wi-Fi" | grep -E "Enabled|Server|Port" - - echo "" - echo "=== Active SSH Tunnels ===" - local tunnels=$(ps aux | grep -E "ssh -D $port" | grep -v grep) - if [[ -n "$tunnels" ]]; then - echo "$tunnels" - else - echo "No active SSH tunnels" - fi - } - ''; - - home.packages = with pkgs; [ - # Network and file transfer - lftp - httpie - openssh - gnumake - - # Network diagnostic tools - bind # DNS utilities (dig, nslookup, mdig) - inetutils # Network utilities (telnet) - netcat-gnu # Network connection utility - curl # HTTP client - wget # Web downloader - bandwhich # Terminal bandwidth utilization tool - - # Command-line utilities - ncdu - git-credential-oauth - zoxide - delta - fastfetch - coreutils # GNU core utilities (base64, etc.) - - # macOS-specific GUI applications - maccy # Clipboard manager (macOS-only) - iina # Media player (macOS-optimized) - hidden-bar # Menu bar organizer (macOS-only) - - # Development and build tools - python312 - uv - lazysql - sqlite - ]; -} diff --git a/hosts/darwin/imac/home.nix b/hosts/darwin/imac/home.nix deleted file mode 100644 index e8efc30..0000000 --- a/hosts/darwin/imac/home.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ../home-default.nix - ]; - - # MacBook Air-specific home configuration - # Example: Laptop-specific tools, power management, etc. - - # yt-dlp configuration - programs.yt-dlp-custom = { - enable = true; - downloadDir = "~/Downloads/Videos"; - }; -} diff --git a/hosts/darwin/imac/system.nix b/hosts/darwin/imac/system.nix deleted file mode 100644 index 807956d..0000000 --- a/hosts/darwin/imac/system.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, pkgs, ... }: - -{ - # MacBook Air-specific configuration - networking.computerName = "imac"; - networking.hostName = "imac"; - - # Import common Darwin configuration - imports = [ - ../system-default.nix - ]; -} diff --git a/hosts/darwin/mba/home.nix b/hosts/darwin/mba/home.nix deleted file mode 100644 index e8efc30..0000000 --- a/hosts/darwin/mba/home.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ../home-default.nix - ]; - - # MacBook Air-specific home configuration - # Example: Laptop-specific tools, power management, etc. - - # yt-dlp configuration - programs.yt-dlp-custom = { - enable = true; - downloadDir = "~/Downloads/Videos"; - }; -} diff --git a/hosts/darwin/mba/system.nix b/hosts/darwin/mba/system.nix deleted file mode 100644 index 396d64f..0000000 --- a/hosts/darwin/mba/system.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, pkgs, ... }: - -{ - # MacBook Air-specific configuration - networking.computerName = "mba"; - networking.hostName = "mba"; - - # Import common Darwin configuration - imports = [ - ../system-default.nix - ]; -} diff --git a/hosts/darwin/system-default.nix b/hosts/darwin/system-default.nix deleted file mode 100644 index 1537e7b..0000000 --- a/hosts/darwin/system-default.nix +++ /dev/null @@ -1,159 +0,0 @@ -{ config, pkgs, nix-homebrew, ... }: - -{ - imports = [ - ../../modules/homebrew.nix - nix-homebrew.darwinModules.nix-homebrew - ]; - - # Nix configuration - nix.settings.experimental-features = "nix-command flakes"; - nix.settings.substituters = [ - "https://cache.nixos.org/" - "https://nix-community.cachix.org" - "https://devenv.cachix.org" - ]; - nix.settings.trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - ]; - - # System configuration - system.stateVersion = 6; - nixpkgs.hostPlatform = "aarch64-darwin"; - programs.zsh.enable = true; - - # Set primary user for system preferences - system.primaryUser = "yanlin"; - - # Security configuration - passwordless sudo for yanlin - security.sudo.extraConfig = '' - yanlin ALL=(ALL) NOPASSWD: ALL - ''; - - system.defaults = { - dock = { - autohide = true; # Automatically hide and show the dock - autohide-delay = 0.2; # Delay before showing the dock (in seconds) - autohide-time-modifier = 0.5; # Animation duration for dock show/hide - orientation = "bottom"; # Dock position: "bottom", "left", or "right" - tilesize = 48; # Size of dock icons (16-128) - magnification = false; # Enable magnification when hovering - minimize-to-application = false; # Minimize windows to application icon - show-recents = true; # Show recent applications in dock - show-process-indicators = true; # Show dots under running apps - static-only = false; # Show only open applications - mru-spaces = false; # Automatically rearrange spaces based on use - expose-animation-duration = 0.5; # Mission Control animation speed - dashboard-in-overlay = false; # Show Dashboard as overlay - persistent-apps = [ - "/Applications/Firefox.app" - "/Applications/Obsidian.app" - "/Applications/Ghostty.app" - "/Applications/KeePassXC.app" - ]; - persistent-others = [ - "/Users/yanlin/Desktop" - "/Users/yanlin/Downloads" - "/Users/yanlin/Documents" - ]; # List of folders/files to keep in dock - - # Hot Corners - Actions: - # 1 = Disabled, 2 = Mission Control, 3 = Application Windows, - # 4 = Desktop, 5 = Start Screen Saver, 6 = Disable Screen Saver, - # 7 = Dashboard, 10 = Put Display to Sleep, 11 = Launchpad, - # 12 = Notification Center, 13 = Lock Screen, 14 = Quick Note - wvous-tl-corner = 1; # Top left corner action - wvous-tr-corner = 1; # Top right corner action - wvous-bl-corner = 1; # Bottom left corner action - wvous-br-corner = 1; # Bottom right corner action - }; - - finder = { - AppleShowAllExtensions = true; # Show all file extensions - AppleShowAllFiles = true; # Show hidden files - CreateDesktop = true; # Show icons on desktop - FXEnableExtensionChangeWarning = false; # Warn when changing file extension - FXPreferredViewStyle = "Nlsv"; # Default view: "icnv"=Icon, "Nlsv"=List, "clmv"=Column, "glyv"=Gallery - QuitMenuItem = false; # Allow quitting Finder with ⌘Q - ShowPathbar = true; # Show path bar at bottom - ShowStatusBar = true; # Show status bar at bottom - _FXShowPosixPathInTitle = false; # Show full POSIX path in title - _FXSortFoldersFirst = true; # Sort folders before files - }; - - # -------------------------------------------------------------------------- - # Global Domain Settings (NSGlobalDomain) - # -------------------------------------------------------------------------- - NSGlobalDomain = { - AppleInterfaceStyle = "Dark"; # Dark mode: "Dark" or remove for light - AppleInterfaceStyleSwitchesAutomatically = false; # Auto switch dark/light - NSAutomaticWindowAnimationsEnabled = true; # Window animations - NSDocumentSaveNewDocumentsToCloud = false; # Save to iCloud by default - NSNavPanelExpandedStateForSaveMode = true; # Expand save panel by default - PMPrintingExpandedStateForPrint = true; # Expand print panel by default - NSTableViewDefaultSizeMode = 2; # Sidebar icon size: 1=small, 2=medium, 3=large - AppleShowScrollBars = "WhenScrolling"; # "WhenScrolling", "Automatic", or "Always" - NSScrollAnimationEnabled = true; # Smooth scrolling - NSWindowResizeTime = 0.2; # Window resize animation duration - _HIHideMenuBar = false; # Auto-hide menu bar - - NSAutomaticCapitalizationEnabled = false; # Disable automatic capitalization - NSAutomaticDashSubstitutionEnabled = false; # Disable smart dashes - NSAutomaticPeriodSubstitutionEnabled = false; # Disable automatic period with double-space - NSAutomaticQuoteSubstitutionEnabled = false; # Disable smart quotes - NSAutomaticSpellingCorrectionEnabled = false; # Disable auto-correction - NSAutomaticInlinePredictionEnabled = false; # Disable inline predictive text - "com.apple.keyboard.fnState" = false; # Use F1, F2, etc. as standard function keys - }; - - screencapture = { - disable-shadow = true; # Disable shadow in screenshots - location = "~/Desktop"; # Default save location - type = "png"; # Screenshot format: png, jpg, pdf, etc. - show-thumbnail = true; # Show thumbnail after taking screenshot - }; - - loginwindow = { - GuestEnabled = false; # Disable guest account - ShutDownDisabled = false; # Allow shutdown from login window - RestartDisabled = false; # Allow restart from login window - SleepDisabled = false; # Allow sleep from login window - }; - - spaces = { - spans-displays = false; # Each display has separate spaces - }; - }; - - system.activationScripts.extraActivation.text = '' - sudo -u yanlin defaults -currentHost write -globalDomain NSStatusItemSpacing -int 10 - - # Disable Spotlight indexing for all volumes - # WARNING: This will break Mail.app search, Time Machine, and other features - # To re-enable: sudo mdutil -a -i on - sudo mdutil -a -i off - sudo mdutil -E / - - /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u - ''; - - # Key remapping using hidutil via launchd agent - # This swaps Control and Caps Lock keys bidirectionally - launchd.user.agents.remap-keys = { - serviceConfig = { - ProgramArguments = [ - "/usr/bin/hidutil" - "property" - "--set" - ''{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0},{"HIDKeyboardModifierMappingSrc":0x7000000E0,"HIDKeyboardModifierMappingDst":0xFF00000003}]}'' - ]; - RunAtLoad = true; - KeepAlive = false; - Label = "org.nixos.remap-keys"; - StandardErrorPath = "/tmp/remap-keys.err"; - StandardOutPath = "/tmp/remap-keys.out"; - }; - }; -} diff --git a/modules/homebrew.nix b/modules/homebrew.nix deleted file mode 100644 index 5ba0761..0000000 --- a/modules/homebrew.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Homebrew configuration for package management - homebrew = { - enable = true; - onActivation = { - autoUpdate = true; - cleanup = "zap"; # Removes unlisted formulae/casks - upgrade = true; - }; - brews = [ - # Command-line tools go here - ]; - casks = [ - # GUI applications - manually installed apps now managed by Homebrew - "keepassxc" - "keycastr" - "inkscape" - "firefox" - "obsidian" - "snipaste" - "ghostty" - "slidepilot" - "tencent-meeting" - "ovito" - "microsoft-powerpoint" - "microsoft-word" - "microsoft-excel" - "rectangle" - ]; - taps = [ - # Additional repositories if needed - ]; - }; - - # nix-homebrew configuration for declarative Homebrew installation - nix-homebrew = { - enable = true; - enableRosetta = true; # Apple Silicon support - user = "yanlin"; - autoMigrate = true; # Migrate existing Homebrew if present - }; -} diff --git a/modules/lazygit.nix b/modules/lazygit.nix index a129506..bbe1629 100644 --- a/modules/lazygit.nix +++ b/modules/lazygit.nix @@ -334,8 +334,8 @@ # OS settings os = { - open = if pkgs.stdenv.isDarwin then "open {{filename}}" else "xdg-open {{filename}}"; - openLink = if pkgs.stdenv.isDarwin then "open {{link}}" else "xdg-open {{link}}"; + open = "xdg-open {{filename}}"; + openLink = "xdg-open {{link}}"; }; # Disable startup popup diff --git a/modules/nvim.nix b/modules/nvim.nix index f4b7803..93dac13 100644 --- a/modules/nvim.nix +++ b/modules/nvim.nix @@ -264,8 +264,8 @@ in { mode = "n"; key = "f"; - action = ":lua show_file_in_finder()"; - options = { desc = "Show current file in Finder"; }; + action = ":lua show_file_in_file_manager()"; + options = { desc = "Show current file in file manager"; }; } ]; @@ -298,20 +298,11 @@ in }) -- Dictionary completion setup - ${lib.optionalString pkgs.stdenv.isDarwin '' - require("cmp_dictionary").setup({ - paths = { "/usr/share/dict/words" }, -- Standard dictionary path on macOS - exact_length = 2, -- Minimum length before completion - first_case_insensitive = true, -- Case insensitive matching - }) - ''} - ${lib.optionalString (!pkgs.stdenv.isDarwin) '' - require("cmp_dictionary").setup({ - paths = { "${pkgs.scowl}/share/dict/wamerican.txt" }, -- Nix-provided dictionary on NixOS - exact_length = 2, -- Minimum length before completion - first_case_insensitive = true, -- Case insensitive matching - }) - ''} + require("cmp_dictionary").setup({ + paths = { "${pkgs.scowl}/share/dict/wamerican.txt" }, -- Nix-provided dictionary + exact_length = 2, -- Minimum length before completion + first_case_insensitive = true, -- Case insensitive matching + }) -- Jupytext setup for Jupyter notebook viewing require("jupytext").setup({ @@ -352,21 +343,18 @@ in } -- OSC-52 clipboard integration (matches tmux setup, works with Ghostty) - -- This enables clipboard functionality across SSH, tmux, and multi-platform - -- Only enabled on Linux; macOS uses native clipboard with "unnamedplus" - ${lib.optionalString (!pkgs.stdenv.isDarwin) '' - vim.g.clipboard = { - name = 'OSC 52', - copy = { - ['+'] = require('vim.ui.clipboard.osc52').copy('+'), - ['*'] = require('vim.ui.clipboard.osc52').copy('*'), - }, - paste = { - ['+'] = require('vim.ui.clipboard.osc52').paste('+'), - ['*'] = require('vim.ui.clipboard.osc52').paste('*'), - }, - } - ''} + -- This enables clipboard functionality across SSH and tmux + vim.g.clipboard = { + name = 'OSC 52', + copy = { + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { + ['+'] = require('vim.ui.clipboard.osc52').paste('+'), + ['*'] = require('vim.ui.clipboard.osc52').paste('*'), + }, + } -- Close all buffers except current (preserving NvimTree and other special buffers) function close_other_buffers() @@ -392,26 +380,21 @@ in local filepath = vim.fn.expand('%:p') if filepath ~= "" then local escaped_path = vim.fn.shellescape(filepath) - ${if pkgs.stdenv.isDarwin then - "vim.fn.system('open ' .. escaped_path)" - else - "vim.fn.system('xdg-open ' .. escaped_path)"} + vim.fn.system('xdg-open ' .. escaped_path) else print("No file to open") end end - ${lib.optionalString pkgs.stdenv.isDarwin '' - function show_file_in_finder() - local filepath = vim.fn.expand('%:p') - if filepath ~= "" then - local escaped_path = vim.fn.shellescape(filepath) - vim.fn.system('open -R ' .. escaped_path) - else - print("No file to show") - end + function show_file_in_file_manager() + local filepath = vim.fn.expand('%:p') + if filepath ~= "" then + local escaped_path = vim.fn.shellescape(filepath) + vim.fn.system('nautilus --select ' .. escaped_path) + else + print("No file to show") end - ''} + end ''; }; } diff --git a/modules/papis.nix b/modules/papis.nix index 900a5dd..0795fa6 100644 --- a/modules/papis.nix +++ b/modules/papis.nix @@ -1,19 +1,14 @@ { pkgs, lib, ... }: -let - # Platform-aware papis config directory - papisConfigDir = if pkgs.stdenv.isDarwin then "Library/Application Support/papis" else ".config/papis"; -in - { # Install papis package home.packages = [ pkgs.papis ]; # Papis configuration - home.file."${papisConfigDir}/config".text = '' + home.file.".config/papis/config".text = '' [settings] default-library = main editor = nvim - opentool = ${if pkgs.stdenv.isDarwin then "open -a Preview" else "evince"} + opentool = evince # Document management ref-format = {doc[author]}{doc[year]} @@ -44,7 +39,7 @@ in ''; # Papis bibliography template - home.file."${papisConfigDir}/templates/bibitem.template".text = '' + home.file.".config/papis/templates/bibitem.template".text = '' {doc[title]} ({doc[year]}). {doc[author]}. Venue: {doc[journal]} {doc[booktitle]} {doc[eprinttype]} {doc[eprint]} {doc[eventtitle]} Tags: {doc[tags]} @@ -53,7 +48,7 @@ in ''; # Papis BibTeX template - home.file."${papisConfigDir}/templates/bibtex.template".text = '' + home.file.".config/papis/templates/bibtex.template".text = '' @{doc[type]}{{{doc[ref]}, author = {{{doc[author]}}}, title = {{{doc[title]}}}, @@ -69,23 +64,23 @@ in ''; # Papis citation template - home.file."${papisConfigDir}/templates/citation.template".text = '' + home.file.".config/papis/templates/citation.template".text = '' {doc[author]}. "{doc[title]}." {doc[journal]}{doc[booktitle]} ({doc[year]}). ''; # Shell aliases for papis workflow programs.zsh.shellAliases = { # Bibliography formatting - pals = "papis list --template \"$HOME/${papisConfigDir}/templates/bibitem.template\""; + pals = "papis list --template \"$HOME/.config/papis/templates/bibitem.template\""; # Add new entry with bibtex paadd = "papis add --from bibtex"; # BibTeX export - pabib = "papis list --template \"$HOME/${papisConfigDir}/templates/bibtex.template\""; + pabib = "papis list --template \"$HOME/.config/papis/templates/bibtex.template\""; # Citation formatting - pacite = "papis list --template \"$HOME/${papisConfigDir}/templates/citation.template\""; + pacite = "papis list --template \"$HOME/.config/papis/templates/citation.template\""; # File operations paurl = "papis addto -u"; diff --git a/modules/rsync.nix b/modules/rsync.nix index b9d55e2..904204f 100644 --- a/modules/rsync.nix +++ b/modules/rsync.nix @@ -22,13 +22,7 @@ --delete-excluded --partial --partial-dir=.rsync-partial - - ${lib.optionalString pkgs.stdenv.isDarwin '' - # Preserve extended attributes and ACLs (macOS) - --extended-attributes - --acls - ''} - + # Network optimization --compress --compress-level=6 diff --git a/modules/syncthing.nix b/modules/syncthing.nix index 8fde634..016f2ef 100644 --- a/modules/syncthing.nix +++ b/modules/syncthing.nix @@ -94,11 +94,6 @@ in }; }; }; - - # Override the launchd agent to add RunAtLoad on macOS - launchd.agents.syncthing = lib.mkIf (pkgs.stdenv.isDarwin && config.services.syncthing.enable) { - config.RunAtLoad = true; - }; # Deploy .stignore files to synced folders home.file."Credentials/.stignore".text = stignoreContent; diff --git a/modules/termscp.nix b/modules/termscp.nix index dc32755..2697a81 100644 --- a/modules/termscp.nix +++ b/modules/termscp.nix @@ -3,7 +3,7 @@ { # Install termscp package home.packages = [ pkgs.termscp ]; - home.file.${if pkgs.stdenv.isDarwin then "Library/Application Support/termscp/config.toml" else ".config/termscp/config.toml"}.text = '' + home.file.".config/termscp/config.toml".text = '' # termscp configuration file # Generated by Nix - see modules/termscp.nix for customization