feat: try to fix fcitx5

This commit is contained in:
ryan4yin
2023-05-07 17:48:26 +08:00
parent 381f0c5123
commit 79c424e08e
28 changed files with 76 additions and 93 deletions

63
flake.lock generated
View File

@@ -38,21 +38,6 @@
}
},
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
@@ -77,11 +62,11 @@
]
},
"locked": {
"lastModified": 1683276747,
"narHash": "sha256-T3st1VBg3wmhHyBQb0z12sTSGsQgiu3mxkS61nLO8Xs=",
"lastModified": 1683456233,
"narHash": "sha256-BUclM2YmS0rpkSlHSvJ+5aWTu+OcjFiI4iIMRt9qCuI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "669669fcb403e3137dfe599bbcc26e60502c3543",
"rev": "990b82ecd31f6372bc4c3f39a9171961bc370a22",
"type": "github"
},
"original": {
@@ -134,7 +119,7 @@
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
@@ -170,27 +155,6 @@
"type": "github"
}
},
"nixos-cn": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1682818384,
"narHash": "sha256-l8jh9BQj6nfjPDYGyrZkZwX1GaOqBX+pBHU+7fFZU3w=",
"owner": "nixos-cn",
"repo": "flakes",
"rev": "2d475ec68cca251ef6c6c69a9224db5c264c5e5b",
"type": "github"
},
"original": {
"owner": "nixos-cn",
"repo": "flakes",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1683014792,
@@ -246,11 +210,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1683409501,
"narHash": "sha256-FyLWNsqwp0iZ3EfRqocC/V3Unm0ENVGByyd4dKFRhcI=",
"lastModified": 1683454517,
"narHash": "sha256-T3ObyRj1BsR0MZfIqZ/y8dSqRBeRBulrnWYiFQaz98o=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "19019499709f728a33b91686dc4b8bb5fd391b8d",
"rev": "e40b5d9061325d66acb598e0ae7038ca149d626d",
"type": "github"
},
"original": {
@@ -261,11 +225,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1683286087,
"narHash": "sha256-xseOd7W7xwF5GOF2RW8qhjmVGrKoBz+caBlreaNzoeI=",
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3e313808bd2e0a0669430787fb22e43b2f4bf8bf",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github"
},
"original": {
@@ -293,11 +257,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1683286087,
"narHash": "sha256-xseOd7W7xwF5GOF2RW8qhjmVGrKoBz+caBlreaNzoeI=",
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3e313808bd2e0a0669430787fb22e43b2f4bf8bf",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github"
},
"original": {
@@ -311,7 +275,6 @@
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"nixos-cn": "nixos-cn",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-wayland": "nixpkgs-wayland"

View File

@@ -19,13 +19,13 @@
extra-substituters = [
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
"https://nixos-cn.cachix.org"
# "https://nixos-cn.cachix.org"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
"nixos-cn.cachix.org-1:L0jEaL6w7kwQOPlLoCR3ADx+E3Q8SEFEcB9Jaibl0Xg="
# "nixos-cn.cachix.org-1:L0jEaL6w7kwQOPlLoCR3ADx+E3Q8SEFEcB9Jaibl0Xg="
];
};
@@ -47,12 +47,12 @@
# community wayland nixpkgs
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# nixos-cn 提供了一些国内常用的程序包,如 qq wechat dingtalk 等
nixos-cn = {
url = "github:nixos-cn/flakes";
# 强制 nixos-cn 和该 flake 使用相同版本的 nixpkgs
inputs.nixpkgs.follows = "nixpkgs";
};
# # nixos-cn 提供了一些国内常用的程序包,如 qq wechat dingtalk 等
# nixos-cn = {
# url = "github:nixos-cn/flakes";
# # 强制 nixos-cn 和该 flake 使用相同版本的 nixpkgs
# inputs.nixpkgs.follows = "nixpkgs";
# };
};
# outputs 的参数都是 inputs 中定义的依赖项,可以通过它们的名称来引用。
@@ -63,7 +63,7 @@
nixpkgs,
nixpkgs-stable,
home-manager,
nixos-cn,
# nixos-cn,
...
}: {
# 名为 nixosConfigurations 的 outputs 会在执行 `nixos-rebuild switch --flake .` 时被使用
@@ -88,7 +88,7 @@
# nix flake 的 modules 系统可将配置模块化,提升配置的可维护性
# 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs
specialArgs = {
inherit nixos-cn;
# inherit nixos-cn;
inherit nixpkgs-stable;
};
modules = [
@@ -121,7 +121,7 @@
system = "x86_64-linux";
specialArgs = {
inherit nixos-cn;
# inherit nixos-cn;
inherit nixpkgs-stable;
};
modules = [

View File

@@ -3,7 +3,6 @@
{
imports = [
./fcitx5
./hyprland
./programs
./rofi

View File

@@ -1,28 +0,0 @@
{ config, pkgs, ... }:
{
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons =
let
# 为了不使用默认的 rime-data改用我自定义的小鹤音形数据这里需要 override
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
config.packageOverrides = pkgs: {
fcitx5-rime = pkgs.fcitx5-rime.override {rimeDataPkgs = [
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
./rime-data-flypy
];};
};
in
with pkgs; [
# for flypy chinese input method
fcitx5-rime
# needed enable rime using configtool after installed
fcitx5-configtool
# fcitx5-chinese-addons
# fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
};
}

View File

@@ -17,6 +17,7 @@
systemd.user.sessionVariables = {
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
"MOZ_WEBRENDER" = "1";
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
"LIBVA_DRIVER_NAME" = "nvidia";
@@ -24,5 +25,15 @@
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"WLR_NO_HARDWARE_CURSORS" = "1";
"WLR_EGL_NO_MODIFIRES" = "1";
# copy from https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
GLFW_IM_MODULE = "fcitx";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx";
};
}
}

View File

@@ -190,3 +190,11 @@ bind=SUPER,mouse_up,workspace,e-1
#-- Startup ----------------------------------------------------
exec-once=~/.config/hypr/scripts/startup
#-- Fcitx5 input method ----------------------------------------------------
windowrule=pseudo,fcitx
exec-once=fcitx5-remote -r
exec-once=fcitx5 -d --replace
exec-once=fcitx5-remote -r
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r

View File

@@ -7,7 +7,7 @@
pkgs-stable = import nixpkgs-stable {
system = pkgs.system;
config.allowUnfree = true;
};
};
in {
home.packages = with pkgs-stable; [
firefox-wayland

View File

@@ -8,7 +8,7 @@
./common.nix
./git.nix
./media.nix
./nixos-cn.nix
# ./nixos-cn.nix
./xdg.nix
];
}

View File

@@ -9,6 +9,7 @@
[
../../modules/system.nix
../../modules/hyprland.nix
../../modules/fcitx5
# Include the results of the hardware scan.
./hardware-configuration.nix

View File

@@ -9,6 +9,7 @@
[
../../modules/system.nix
../../modules/hyprland.nix
../../modules/fcitx5
# Include the results of the hardware scan.
./hardware-configuration.nix

View File

@@ -0,0 +1,28 @@
{ config, pkgs, ... }:
# related issues: https://github.com/hyprwm/Hyprland/discussions/421
{
# 为了不使用默认的 rime-data改用我自定义的小鹤音形数据这里需要 override
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
nixpkgs.overlays = [
(self: super: {
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
rime-data = ./rime-data-flypy;
fcitx5-rime = super.fcitx5-rime.override { rimeDataPkgs = [ ./rime-data-flypy ]; };
})
];
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
# for flypy chinese input method
fcitx5-rime
# needed enable rime using configtool after installed
fcitx5-configtool
fcitx5-chinese-addons
# fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
};
}