From c5d4de5a9d240518d9980659c2ed070c7585cc55 Mon Sep 17 00:00:00 2001 From: moons Date: Mon, 27 Jul 2026 14:06:13 +0900 Subject: [PATCH] add fcitx5, ghostty, git --- modules/applications/fcitx5/home.nix | 6 ++ modules/applications/fcitx5/nixos.nix | 34 ++++++++++ modules/applications/ghostty/darwin.nix | 6 ++ modules/applications/ghostty/dracula.theme | 44 ++++++++++++ modules/applications/ghostty/home.nix | 49 ++++++++++++++ modules/applications/git/home.nix | 78 ++++++++++++++++++++++ 6 files changed, 217 insertions(+) create mode 100644 modules/applications/fcitx5/home.nix create mode 100644 modules/applications/fcitx5/nixos.nix create mode 100644 modules/applications/ghostty/darwin.nix create mode 100644 modules/applications/ghostty/dracula.theme create mode 100644 modules/applications/ghostty/home.nix create mode 100644 modules/applications/git/home.nix diff --git a/modules/applications/fcitx5/home.nix b/modules/applications/fcitx5/home.nix new file mode 100644 index 0000000..5b561cd --- /dev/null +++ b/modules/applications/fcitx5/home.nix @@ -0,0 +1,6 @@ +{ + home.file.".config/fcitx5/config" = { + recursive = true; + source = ./config; + }; +} diff --git a/modules/applications/fcitx5/nixos.nix b/modules/applications/fcitx5/nixos.nix new file mode 100644 index 0000000..278d4af --- /dev/null +++ b/modules/applications/fcitx5/nixos.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: +{ + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + + fcitx5 = { + waylandFrontend = true; + addons = with pkgs; [ + fcitx5-mozc-ut + fcitx5-gtk + kdePackages.fcitx5-qt + qt6Packages.fcitx5-configtool + ]; + + settings.inputMethod = { + GroupOrder."0" = "Default"; + "Groups/0" = { + Name = "Default"; + "Default Layout" = "jp"; + DefaultIM = "mozc"; + }; + "Groups/0/Items/0" = { + Name = "keyboard-jp"; + Layout = ""; + }; + "Groups/0/Items/1" = { + Name = "mozc"; + Layout = ""; + }; + }; + }; + }; +} diff --git a/modules/applications/ghostty/darwin.nix b/modules/applications/ghostty/darwin.nix new file mode 100644 index 0000000..0991a4e --- /dev/null +++ b/modules/applications/ghostty/darwin.nix @@ -0,0 +1,6 @@ +{ + homebrew = { + enable = true; + casks = [ "ghostty" ]; + }; +} diff --git a/modules/applications/ghostty/dracula.theme b/modules/applications/ghostty/dracula.theme new file mode 100644 index 0000000..2b274f3 --- /dev/null +++ b/modules/applications/ghostty/dracula.theme @@ -0,0 +1,44 @@ +# MIT License +# +# Copyright (c) 2023 Dracula Theme +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +palette = 0=#21222c +palette = 1=#ff5555 +palette = 2=#50fa7b +palette = 3=#f1fa8c +palette = 4=#bd93f9 +palette = 5=#ff79c6 +palette = 6=#8be9fd +palette = 7=#f8f8f2 +palette = 8=#6272a4 +palette = 9=#ff6e6e +palette = 10=#69ff94 +palette = 11=#ffffa5 +palette = 12=#d6acff +palette = 13=#ff92df +palette = 14=#a4ffff +palette = 15=#ffffff +background = #282a36 +foreground = #f8f8f2 +cursor-color = #f8f8f2 +cursor-text = #282a36 +selection-foreground = #f8f8f2 +selection-background = #44475a diff --git a/modules/applications/ghostty/home.nix b/modules/applications/ghostty/home.nix new file mode 100644 index 0000000..199fc8d --- /dev/null +++ b/modules/applications/ghostty/home.nix @@ -0,0 +1,49 @@ +{ + inputs, + pkgs, + ... +}: +let + package = + if pkgs.stdenv.hostPlatform.isLinux then + inputs.ghostty.packages.${pkgs.stdenv.hostPlatform.system}.ghostty-releasefast + else + null; +in +{ + programs.ghostty = { + enable = true; + inherit package; + systemd.enable = pkgs.stdenv.hostPlatform.isLinux; + + settings = { + theme = "dracula"; + background-blur-radius = 20; + background-opacity = 0.9; + font-family = "BlexMono Nerd Font Mono"; + mouse-hide-while-typing = true; + window-decoration = "auto"; + + keybind = [ + "performable:ctrl+shift+c=copy_to_clipboard" + "ctrl+shift+v=paste_from_clipboard" + "ctrl+shift+t=new_tab" + "ctrl+alt+left_bracket=previous_tab" + "ctrl+alt+right_bracket=next_tab" + "ctrl+alt+q=close_window" + "ctrl+shift+semicolon=increase_font_size:1" + "ctrl+shift+minus=decrease_font_size:1" + ]; + + quick-terminal-position = "top"; + quick-terminal-size = "98%,100%"; + quick-terminal-autohide = false; + quick-terminal-keyboard-interactivity = "on-demand"; + gtk-quick-terminal-layer = "top"; + quit-after-last-window-closed = false; + shell-integration-features = "no-ssh-env,no-ssh-terminfo"; + }; + }; + + xdg.configFile."ghostty/themes/dracula".source = ./dracula.theme; +} diff --git a/modules/applications/git/home.nix b/modules/applications/git/home.nix new file mode 100644 index 0000000..7113a25 --- /dev/null +++ b/modules/applications/git/home.nix @@ -0,0 +1,78 @@ +{ pkgs, ... }: +let + signingKeyPath = ".ssh/1password-git-signing.pub"; + signingKeyFile = "~/${signingKeyPath}"; + + gitSshSign = pkgs.writeShellScript "git-ssh-sign" '' + one_password_sock="$HOME/.1password/agent.sock" + + if { [ -n "''${SSH_CONNECTION:-}" ] || [ -n "''${SSH_CLIENT:-}" ]; } \ + && [ -n "''${SSH_AUTH_SOCK:-}" ] \ + && [ -S "$SSH_AUTH_SOCK" ]; then + exec ${pkgs.openssh}/bin/ssh-keygen "$@" + fi + + if [ -S "$one_password_sock" ]; then + export SSH_AUTH_SOCK="$one_password_sock" + exec ${pkgs.openssh}/bin/ssh-keygen "$@" + fi + + if [ -n "''${SSH_AUTH_SOCK:-}" ] && [ -S "$SSH_AUTH_SOCK" ]; then + exec ${pkgs.openssh}/bin/ssh-keygen "$@" + fi + + echo "git ssh signing failed: no forwarded SSH agent or 1Password agent socket found" >&2 + echo "expected: forwarded SSH_AUTH_SOCK or $one_password_sock" >&2 + exit 1 + ''; +in +{ + home.packages = [ pkgs.gh ]; + + home.file.${signingKeyPath}.text = '' + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLwReAiwhXoO34S2+MrvqUhi8IWp4IzUq4OSp3niJdq 1password-git-signing + ''; + + programs.git = { + enable = true; + + ignores = [ + ".direnv/" + ".envrc" + "!.envrc.example" + ]; + + signing = { + key = signingKeyFile; + format = "ssh"; + signByDefault = true; + }; + + settings = { + user = { + name = "moons"; + email = "moons@moons14.com"; + }; + + push.default = "simple"; + credential.helper = "cache --timeout=7200"; + init.defaultBranch = "main"; + log.decorate = "full"; + log.date = "iso"; + merge.conflictStyle = "diff3"; + + gpg.ssh.program = "${gitSshSign}"; + + alias = { + br = "branch --sort=-committerdate"; + co = "checkout"; + df = "diff"; + com = "commit -a"; + gs = "stash"; + gp = "pull"; + lg = "log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %C(green)(%cr)%C(bold blue) <%an>%Creset' --abbrev-commit"; + st = "status"; + }; + }; + }; +}