nix-darwin: home for darwin

This commit is contained in:
js0ny 2025-11-21 08:03:59 +00:00
parent f68ac5a89a
commit 3e0fa1770e
11 changed files with 353 additions and 291 deletions

View file

@ -157,6 +157,8 @@
extraSpecialArgs = specialArgs; extraSpecialArgs = specialArgs;
modules = [ modules = [
./users/js0ny/zen.nix ./users/js0ny/zen.nix
catppuccin.homeModules.catppuccin
betterfox-nix.modules.homeManager.betterfox
]; ];
}; };
}; };

View file

@ -30,14 +30,7 @@
"wireshark-app" "wireshark-app"
"clash-verge-rev" "clash-verge-rev"
# Editor
"visual-studio-code"
# Browsers
"firefox"
# Terminal Emulator # Terminal Emulator
"ghostty"
"kitty" "kitty"
# Fonts # Fonts
@ -54,7 +47,7 @@
"alt-tab" # Turn cmd-tab to windows behaviour "alt-tab" # Turn cmd-tab to windows behaviour
"karabiner-elements" # Keymapping "karabiner-elements" # Keymapping
"localsend" "localsend"
"squirrel" # Input Method "squirrel-app" # Input Method
"rustdesk" # Remote Desktop "rustdesk" # Remote Desktop
"iina" # MPV Frontend "iina" # MPV Frontend
# TODO: I think karabiner is the superset # TODO: I think karabiner is the superset

View file

@ -1,4 +1,4 @@
{...}: { {pkgs, ...}: {
system.defaults.dock = { system.defaults.dock = {
appswitcher-all-displays = true; appswitcher-all-displays = true;
autohide = true; autohide = true;
@ -8,15 +8,14 @@
mineffect = "suck"; mineffect = "suck";
minimize-to-application = true; minimize-to-application = true;
persistent-apps = [ persistent-apps = [
{app = "/Applications/Vivaldi.app";} {app = "${pkgs.firefox}/Applications/Firefox.app";}
{app = "/Applications/kitty.app";} {app = "${pkgs.ghostty-bin}/Applications/Ghostty.app";}
{app = "/Applications/Obsidian.app";} {app = "/Applications/Obsidian.app";}
{app = "Applications/Visual Studio Code.app";}
# { app = "/Applications/LibreWolf.app"; } # { app = "/Applications/LibreWolf.app"; }
# { spacer = { small = false; }; } # { spacer = { small = false; }; }
# { spacer = { small = true; }; } # { spacer = { small = true; }; }
# { folder = "/System/Applications/Utilities"; } # { folder = "/System/Applications/Utilities"; }
# { folder = "/Users/js0ny/Downloads/"; } # {folder = "/Users/js0ny/Downloads/";}
]; ];
persistent-others = [ persistent-others = [
"/Users/js0ny/Downloads" "/Users/js0ny/Downloads"

View file

@ -1,281 +1,284 @@
{pkgs, ...}: { {pkgs, ...}: {
# Use: https://github.com/TemariVirus/fcitx-ini2nix # Use: https://github.com/TemariVirus/fcitx-ini2nix
i18n.inputMethod = { i18n.inputMethod =
enable = true; if pkgs.stdenv.isDarwin
type = "fcitx5"; then {enable = false;}
fcitx5 = { else {
waylandFrontend = true; enable = true;
addons = with pkgs; [ type = "fcitx5";
fcitx5-rime fcitx5 = {
kdePackages.fcitx5-configtool waylandFrontend = true;
kdePackages.fcitx5-qt addons = with pkgs; [
fcitx5-gtk fcitx5-rime
qt6Packages.fcitx5-chinese-addons kdePackages.fcitx5-configtool
]; kdePackages.fcitx5-qt
settings = { fcitx5-gtk
"inputMethod" = { qt6Packages.fcitx5-chinese-addons
"Groups/0" = { ];
# Group Name settings = {
"Name" = ''Default''; "inputMethod" = {
# Layout "Groups/0" = {
"Default Layout" = ''us''; # Group Name
# Default Input Method "Name" = ''Default'';
"DefaultIM" = ''keyboard-us''; # Layout
}; "Default Layout" = ''us'';
"Groups/0/Items/0" = { # Default Input Method
# Name "DefaultIM" = ''keyboard-us'';
"Name" = ''rime''; };
# Layout "Groups/0/Items/0" = {
"Layout" = ''''; # Name
}; "Name" = ''rime'';
"Groups/0/Items/1" = { # Layout
# Name "Layout" = '''';
"Name" = ''keyboard-us''; };
# Layout "Groups/0/Items/1" = {
"Layout" = ''''; # Name
}; "Name" = ''keyboard-us'';
"GroupOrder" = { # Layout
"0" = ''Default''; "Layout" = '''';
}; };
}; "GroupOrder" = {
"globalOptions" = { "0" = ''Default'';
"Hotkey" = {
# Enumerate when holding modifier of Toggle key
"EnumerateWithTriggerKeys" = ''True'';
# Temporarily Toggle Input Method
"AltTriggerKeys" = '''';
# Skip first input method while enumerating
"EnumerateSkipFirst" = ''False'';
# Enumerate Input Method Group Forward
"EnumerateGroupForwardKeys" = '''';
# Enumerate Input Method Group Backward
"EnumerateGroupBackwardKeys" = '''';
# Time limit in milliseconds for triggering modifier key shortcuts
"ModifierOnlyKeyTimeout" = ''250'';
};
"Hotkey/TriggerKeys" = {
"0" = ''Zenkaku_Hankaku'';
"1" = ''Hangul'';
};
"Hotkey/ActivateKeys" = {
"0" = ''Hangul_Hanja'';
};
"Hotkey/DeactivateKeys" = {
"0" = ''Hangul_Romaja'';
};
"Hotkey/EnumerateForwardKeys" = {
"0" = ''Super+space'';
};
"Hotkey/EnumerateBackwardKeys" = {
"0" = ''Shift+Super+space'';
};
"Hotkey/PrevPage" = {
"0" = ''Up'';
};
"Hotkey/NextPage" = {
"0" = ''Down'';
};
"Hotkey/PrevCandidate" = {
"0" = ''Shift+Tab'';
};
"Hotkey/NextCandidate" = {
"0" = ''Tab'';
};
"Hotkey/TogglePreedit" = {
"0" = ''Control+Alt+P'';
};
"Behavior" = {
# Active By Default
"ActiveByDefault" = ''False'';
# Reset state on Focus In
"resetStateWhenFocusIn" = ''No'';
# Share Input State
"ShareInputState" = ''No'';
# Show preedit in application
"PreeditEnabledByDefault" = ''True'';
# Show Input Method Information when switch input method
"ShowInputMethodInformation" = ''True'';
# Show Input Method Information when changing focus
"showInputMethodInformationWhenFocusIn" = ''False'';
# Show compact input method information
"CompactInputMethodInformation" = ''True'';
# Show first input method information
"ShowFirstInputMethodInformation" = ''True'';
# Default page size
"DefaultPageSize" = ''5'';
# Override XKB Option
"OverrideXkbOption" = ''False'';
# Custom XKB Option
"CustomXkbOption" = '''';
# Force Enabled Addons
"EnabledAddons" = '''';
# Force Disabled Addons
"DisabledAddons" = '''';
# Preload input method to be used by default
"PreloadInputMethod" = ''True'';
# Allow input method in the password field
"AllowInputMethodForPassword" = ''False'';
# Show preedit text when typing password
"ShowPreeditForPassword" = ''False'';
# Interval of saving user data in minutes
"AutoSavePeriod" = ''30'';
};
};
"addons" = {
"clipboard" = {
"globalSection" = {
# Trigger Key
"TriggerKey" = '''';
# Paste Primary
"PastePrimaryKey" = '''';
# Number of entries
"Number of entries" = ''5'';
# Do not show password from password managers
"IgnorePasswordFromPasswordManager" = ''False'';
# Display passwords as plain text
"ShowPassword" = ''False'';
# Seconds before clearing password
"ClearPasswordAfter" = ''30'';
}; };
}; };
"kimpanel" = { "globalOptions" = {
"globalSection" = { "Hotkey" = {
# Prefer Text Icon # Enumerate when holding modifier of Toggle key
"PreferTextIcon" = ''False''; "EnumerateWithTriggerKeys" = ''True'';
# Temporarily Toggle Input Method
"AltTriggerKeys" = '''';
# Skip first input method while enumerating
"EnumerateSkipFirst" = ''False'';
# Enumerate Input Method Group Forward
"EnumerateGroupForwardKeys" = '''';
# Enumerate Input Method Group Backward
"EnumerateGroupBackwardKeys" = '''';
# Time limit in milliseconds for triggering modifier key shortcuts
"ModifierOnlyKeyTimeout" = ''250'';
};
"Hotkey/TriggerKeys" = {
"0" = ''Zenkaku_Hankaku'';
"1" = ''Hangul'';
};
"Hotkey/ActivateKeys" = {
"0" = ''Hangul_Hanja'';
};
"Hotkey/DeactivateKeys" = {
"0" = ''Hangul_Romaja'';
};
"Hotkey/EnumerateForwardKeys" = {
"0" = ''Super+space'';
};
"Hotkey/EnumerateBackwardKeys" = {
"0" = ''Shift+Super+space'';
};
"Hotkey/PrevPage" = {
"0" = ''Up'';
};
"Hotkey/NextPage" = {
"0" = ''Down'';
};
"Hotkey/PrevCandidate" = {
"0" = ''Shift+Tab'';
};
"Hotkey/NextCandidate" = {
"0" = ''Tab'';
};
"Hotkey/TogglePreedit" = {
"0" = ''Control+Alt+P'';
};
"Behavior" = {
# Active By Default
"ActiveByDefault" = ''False'';
# Reset state on Focus In
"resetStateWhenFocusIn" = ''No'';
# Share Input State
"ShareInputState" = ''No'';
# Show preedit in application
"PreeditEnabledByDefault" = ''True'';
# Show Input Method Information when switch input method
"ShowInputMethodInformation" = ''True'';
# Show Input Method Information when changing focus
"showInputMethodInformationWhenFocusIn" = ''False'';
# Show compact input method information
"CompactInputMethodInformation" = ''True'';
# Show first input method information
"ShowFirstInputMethodInformation" = ''True'';
# Default page size
"DefaultPageSize" = ''5'';
# Override XKB Option
"OverrideXkbOption" = ''False'';
# Custom XKB Option
"CustomXkbOption" = '''';
# Force Enabled Addons
"EnabledAddons" = '''';
# Force Disabled Addons
"DisabledAddons" = '''';
# Preload input method to be used by default
"PreloadInputMethod" = ''True'';
# Allow input method in the password field
"AllowInputMethodForPassword" = ''False'';
# Show preedit text when typing password
"ShowPreeditForPassword" = ''False'';
# Interval of saving user data in minutes
"AutoSavePeriod" = ''30'';
}; };
}; };
"cloudpinyin" = { "addons" = {
"globalSection" = { "clipboard" = {
# Toggle Key "globalSection" = {
"Toggle Key" = ''''; # Trigger Key
# Minimum Pinyin Length "TriggerKey" = '''';
"MinimumPinyinLength" = ''4''; # Paste Primary
# Backend "PastePrimaryKey" = '''';
"Backend" = ''GoogleCN''; # Number of entries
# Proxy "Number of entries" = ''5'';
"Proxy" = ''''; # Do not show password from password managers
}; "IgnorePasswordFromPasswordManager" = ''False'';
}; # Display passwords as plain text
"wayland" = { "ShowPassword" = ''False'';
"globalSection" = { # Seconds before clearing password
# Allow Overriding System XKB Settings (Only support KDE5+ and GNOME) "ClearPasswordAfter" = ''30'';
"Allow Overriding System XKB Settings" = ''True'';
};
};
"waylandim" = {
"globalSection" = {
# Detect current running application (Need restart)
"DetectApplication" = ''True'';
# Forward key event instead of commiting text if it is not handled
"PreferKeyEvent" = ''True'';
# Keep virtual keyboard object for V2 Protocol (Need restart)
"PersistentVirtualKeyboard" = ''False'';
};
};
"rime" = {
"globalSection" = {
# Preedit Mode
"PreeditMode" = ''"Do not show"'';
# Shared Input State
"InputState" = ''All'';
# Fix embedded preedit cursor at the beginning of the preedit
"PreeditCursorPositionAtBeginning" = ''True'';
# Action when switching input method
"SwitchInputMethodBehavior" = ''"Commit commit preview"'';
# Deploy
"Deploy" = '''';
# Synchronize
"Synchronize" = '''';
};
};
"classicui" = {
"globalSection" = {
# Vertical Candidate List
"Vertical Candidate List" = ''True'';
# Use mouse wheel to go to prev or next page
"WheelForPaging" = ''True'';
# Font
"Font" = ''"LXGW WenKai Medium 14"'';
# Menu Font
"MenuFont" = ''"LXGW WenKai 14"'';
# Tray Font
"TrayFont" = ''"Sans Bold 10"'';
# Tray Label Outline Color
"TrayOutlineColor" = ''''; #000000
# Tray Label Text Color
"TrayTextColor" = ''''; #ffffff
# Prefer Text Icon
"PreferTextIcon" = ''False'';
# Show Layout Name In Icon
"ShowLayoutNameInIcon" = ''True'';
# Use input method language to display text
"UseInputMethodLanguageToDisplayText" = ''True'';
# Theme
"Theme" = ''plasma'';
# Dark Theme
"DarkTheme" = ''plasma'';
# Follow system light/dark color scheme
"UseDarkTheme" = ''True'';
# Follow system accent color if it is supported by theme and desktop
"UseAccentColor" = ''True'';
# Use Per Screen DPI on X11
"PerScreenDPI" = ''False'';
# Force font DPI on Wayland
"ForceWaylandDPI" = ''0'';
# Enable fractional scale under Wayland
"EnableFractionalScale" = ''True'';
};
};
"quickphrase" = {
"globalSection" = {
# Trigger Key
"TriggerKey" = '''';
# Choose key modifier
"Choose Modifier" = ''None'';
# Enable Spell check
"Spell" = ''True'';
# Fallback Spell check language
"FallbackSpellLanguage" = ''en'';
};
};
"punctuation" = {
"globalSection" = {
# Toggle key
"Hotkey" = '''';
# Half width punctuation after latin letter or number
"HalfWidthPuncAfterLetterOrNumber" = ''True'';
# Type paired punctuations together (e.g. Quote)
"TypePairedPunctuationsTogether" = ''False'';
# Enabled
"Enabled" = ''True'';
};
};
"chttrans" = {
"globalSection" = {
# Translate engine
"Engine" = ''OpenCC'';
# Enabled Input Methods
"EnabledIM" = '''';
# OpenCC profile for Simplified to Traditional
"OpenCCS2TProfile" = ''default'';
# OpenCC profile for Traditional to Simplified
"OpenCCT2SProfile" = ''default'';
};
"sections" = {
"Hotkey" = {
"0" = ''Control+Shift+F'';
}; };
}; };
}; "kimpanel" = {
"notifications" = { "globalSection" = {
"globalSection" = { # Prefer Text Icon
# Hidden Notifications "PreferTextIcon" = ''False'';
"HiddenNotifications" = ''''; };
};
"cloudpinyin" = {
"globalSection" = {
# Toggle Key
"Toggle Key" = '''';
# Minimum Pinyin Length
"MinimumPinyinLength" = ''4'';
# Backend
"Backend" = ''GoogleCN'';
# Proxy
"Proxy" = '''';
};
};
"wayland" = {
"globalSection" = {
# Allow Overriding System XKB Settings (Only support KDE5+ and GNOME)
"Allow Overriding System XKB Settings" = ''True'';
};
};
"waylandim" = {
"globalSection" = {
# Detect current running application (Need restart)
"DetectApplication" = ''True'';
# Forward key event instead of commiting text if it is not handled
"PreferKeyEvent" = ''True'';
# Keep virtual keyboard object for V2 Protocol (Need restart)
"PersistentVirtualKeyboard" = ''False'';
};
};
"rime" = {
"globalSection" = {
# Preedit Mode
"PreeditMode" = ''"Do not show"'';
# Shared Input State
"InputState" = ''All'';
# Fix embedded preedit cursor at the beginning of the preedit
"PreeditCursorPositionAtBeginning" = ''True'';
# Action when switching input method
"SwitchInputMethodBehavior" = ''"Commit commit preview"'';
# Deploy
"Deploy" = '''';
# Synchronize
"Synchronize" = '''';
};
};
"classicui" = {
"globalSection" = {
# Vertical Candidate List
"Vertical Candidate List" = ''True'';
# Use mouse wheel to go to prev or next page
"WheelForPaging" = ''True'';
# Font
"Font" = ''"LXGW WenKai Medium 14"'';
# Menu Font
"MenuFont" = ''"LXGW WenKai 14"'';
# Tray Font
"TrayFont" = ''"Sans Bold 10"'';
# Tray Label Outline Color
"TrayOutlineColor" = ''''; #000000
# Tray Label Text Color
"TrayTextColor" = ''''; #ffffff
# Prefer Text Icon
"PreferTextIcon" = ''False'';
# Show Layout Name In Icon
"ShowLayoutNameInIcon" = ''True'';
# Use input method language to display text
"UseInputMethodLanguageToDisplayText" = ''True'';
# Theme
"Theme" = ''plasma'';
# Dark Theme
"DarkTheme" = ''plasma'';
# Follow system light/dark color scheme
"UseDarkTheme" = ''True'';
# Follow system accent color if it is supported by theme and desktop
"UseAccentColor" = ''True'';
# Use Per Screen DPI on X11
"PerScreenDPI" = ''False'';
# Force font DPI on Wayland
"ForceWaylandDPI" = ''0'';
# Enable fractional scale under Wayland
"EnableFractionalScale" = ''True'';
};
};
"quickphrase" = {
"globalSection" = {
# Trigger Key
"TriggerKey" = '''';
# Choose key modifier
"Choose Modifier" = ''None'';
# Enable Spell check
"Spell" = ''True'';
# Fallback Spell check language
"FallbackSpellLanguage" = ''en'';
};
};
"punctuation" = {
"globalSection" = {
# Toggle key
"Hotkey" = '''';
# Half width punctuation after latin letter or number
"HalfWidthPuncAfterLetterOrNumber" = ''True'';
# Type paired punctuations together (e.g. Quote)
"TypePairedPunctuationsTogether" = ''False'';
# Enabled
"Enabled" = ''True'';
};
};
"chttrans" = {
"globalSection" = {
# Translate engine
"Engine" = ''OpenCC'';
# Enabled Input Methods
"EnabledIM" = '''';
# OpenCC profile for Simplified to Traditional
"OpenCCS2TProfile" = ''default'';
# OpenCC profile for Traditional to Simplified
"OpenCCT2SProfile" = ''default'';
};
"sections" = {
"Hotkey" = {
"0" = ''Control+Shift+F'';
};
};
};
"notifications" = {
"globalSection" = {
# Hidden Notifications
"HiddenNotifications" = '''';
};
}; };
}; };
}; };
}; };
}; };
};
catppuccin.fcitx5.enable = false; catppuccin.fcitx5.enable = false;
} }

View file

@ -1,6 +1,15 @@
{lib, ...}: { {
lib,
pkgs,
...
}: let
profileDir =
if pkgs.stdenv.isDarwin
then "Library/Application Support/Firefox/Profiles"
else ".mozilla/firefox";
in {
# Overwrite search.json.mozlz4 # Overwrite search.json.mozlz4
home.file.".mozilla/firefox/default/search.json.mozlz4".force = lib.mkForce true; home.file."${profileDir}/default/search.json.mozlz4".force = lib.mkForce true;
programs.firefox.profiles.default.search.engines = { programs.firefox.profiles.default.search.engines = {
alternativeto = { alternativeto = {
name = "AlternativeTo"; name = "AlternativeTo";

View file

@ -1,10 +1,21 @@
{config, ...}: { {
config,
pkgs,
...
}: {
programs.ghostty = { programs.ghostty = {
enable = true; enable = true;
package =
if pkgs.stdenv.isLinux
then pkgs.ghostty
else pkgs.ghostty-bin;
enableBashIntegration = true; enableBashIntegration = true;
enableZshIntegration = true; enableZshIntegration = true;
enableFishIntegration = true; enableFishIntegration = true;
systemd.enable = true; systemd.enable =
if pkgs.stdenv.isDarwin
then false
else true;
# Not ready # Not ready
settings = { settings = {
command = "${config.currentUser.defaultShell}"; command = "${config.currentUser.defaultShell}";

View file

@ -1,3 +1,4 @@
# Only use this method in NixOS or non-FHS environment
{pkgs, ...}: let {pkgs, ...}: let
imageTag = "ghcr.io/pdfmathtranslate/pdfmathtranslate-next"; imageTag = "ghcr.io/pdfmathtranslate/pdfmathtranslate-next";
# version = "2.6.4"; # version = "2.6.4";

View file

@ -0,0 +1,13 @@
{
pkgs,
lib,
...
}: {
home.packages = [pkgs.uv];
home.activation.uvInstallPdf2Zh = lib.hm.dag.entryAfter ["writeBoundary"] ''
mkdir -p "$HOME/.local/bin"
if [ ! -f $HOME/.local/bin/pdf2zh ]; then
uv tool install pdf2zh
fi
'';
}

View file

@ -2,7 +2,10 @@
catppuccin.zed.enable = false; catppuccin.zed.enable = false;
programs.zed-editor = { programs.zed-editor = {
enable = true; enable = true;
package = pkgs.zed-editor-fhs; package =
if pkgs.stdenv.isLinux
then pkgs.zed-editor-fhs
else pkgs.zed-editor;
extensions = [ extensions = [
"catppuccin" "catppuccin"
"material-icon-theme" "material-icon-theme"

View file

@ -1,22 +1,50 @@
{...}: { {lib, ...}: {
imports = [ imports = [
./default.nix ./default.nix
# Packages
./packages/cli.nix
./packages/catppuccin.nix
# Shell # Shell
./programs/shell/bash.nix
./programs/shell/zsh.nix ./programs/shell/zsh.nix
./programs/shell/fish.nix ./programs/shell/fish.nix
./programs/shell/direnv.nix
# IME # Programs
./programs/firefox
./programs/zed-editor.nix
./programs/rime.nix ./programs/rime.nix
./programs/nvim.nix
./programs/fzf.nix
./programs/sdcv.nix ./programs/sdcv.nix
./programs/fzf.nix
./programs/nvim.nix
./programs/pdf2zh/uv.nix
./programs/yazi.nix
./programs/edit-clipboard.nix
./programs/neovide.nix
./programs/ghostty.nix
../../modules/home/dev/nix.nix
../../modules/home/programs/eza.nix
../../modules/home/programs/lsd.nix ../../modules/home/programs/lsd.nix
../../modules/home/programs/starship.nix ../../modules/home/programs/starship.nix
../../modules/home/programs/zoxide.nix ../../modules/home/programs/zoxide.nix
../../modules/home/dev/nix.nix
]; ];
home.sessionPath = ["/opt/homebrew/bin"];
programs.nh = {
enable = true;
flake = "/Users/js0ny/.dotfiles/nixcfgs";
clean = {
enable = true;
dates = "weekly";
extraArgs = "--keep 5 --keep-since 3d";
};
};
xdg.desktopEntries = lib.mkForce {};
home.stateVersion = "25.05"; home.stateVersion = "25.05";
} }

View file

@ -35,7 +35,7 @@
./programs/nvim.nix ./programs/nvim.nix
./programs/ollama.nix ./programs/ollama.nix
./programs/sops.nix ./programs/sops.nix
./programs/pdf2zh.nix ./programs/pdf2zh/container.nix
./programs/gwenview.nix ./programs/gwenview.nix
./programs/yazi.nix ./programs/yazi.nix
./programs/dolphin.nix ./programs/dolphin.nix