diff --git a/README.md b/README.md index d788df94..2736014a 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,6 @@ This repository is home to the nix code that builds my systems. - enable disk encryption to enhance data security - make fcitx5-rime work in vscode/chrome on wayland -- adjust the structure of this repo, make it more flexible, and can easily switch between i3, sway and hyprland. -- migrate my private tools & wireguard configurations into nixos, make it a private flake(private github repo), and used it as flake inputs in this repo. ## Why Nix? diff --git a/home/fcitx5/default.nix b/home/fcitx5/default.nix index 31423df5..67fefadf 100644 --- a/home/fcitx5/default.nix +++ b/home/fcitx5/default.nix @@ -1,4 +1,12 @@ -{pkgs, config, ... }: { +{pkgs, config, lib, ... }: { + + home.file.".config/fcitx5/profile".source = ./profile; + home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup + # fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖 + # 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件 + home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] '' + rm -f "${config.xdg.configHome}/fcitx5/profile" + ''; i18n.inputMethod = { enabled = "fcitx5"; @@ -12,4 +20,15 @@ fcitx5-gtk # gtk im module ]; }; + + systemd.user.sessionVariables = { + # 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"; + + }; } \ No newline at end of file diff --git a/home/hyprland/profile b/home/fcitx5/profile similarity index 100% rename from home/hyprland/profile rename to home/fcitx5/profile diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index c482e1a3..07988cc6 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -16,25 +16,10 @@ }; home.file.".gtkrc-2.0".source = ./gtkrc-2.0; home.file.".config/hypr/wallpapers/wallpaper.png".source = ../wallpapers/wallpaper.png; - - home.file.".config/fcitx5/profile".source = ./profile; - home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup - # fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖 - # 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件 - home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] '' - rm -f "${config.xdg.configHome}/fcitx5/profile" - ''; # allow fontconfig to discover fonts and configurations installed through home.packages fonts.fontconfig.enable = true; - # set cursor size and dpi for 4k monitor - # this is for xwayland - xresources.properties = { - "Xcursor.size" = 16; - "Xft.dpi" = 160; - }; - 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 @@ -47,14 +32,14 @@ "__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"; }; + + # set cursor size and dpi for 4k monitor + # this is for xwayland + xresources.properties = { + "Xcursor.size" = 16; + "Xft.dpi" = 160; + }; + } diff --git a/home/i3/default.nix b/home/i3/default.nix index c31de5bc..2675d05c 100644 --- a/home/i3/default.nix +++ b/home/i3/default.nix @@ -19,13 +19,6 @@ executable = true; # make all scripts executable }; - home.file.".config/fcitx5/profile".source = ./profile; - # fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖 - # 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件 - home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] '' - rm -f "${config.xdg.configHome}/fcitx5/profile" - ''; - # allow fontconfig to discover fonts and configurations installed through home.packages fonts.fontconfig.enable = true; @@ -33,14 +26,6 @@ "LIBVA_DRIVER_NAME" = "nvidia"; "GBM_BACKEND" = "nvidia-drm"; "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; - - # 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"; }; # set cursor size and dpi for 4k monitor @@ -48,5 +33,5 @@ "Xcursor.size" = 16; "Xft.dpi" = 160; }; - + } \ No newline at end of file diff --git a/home/i3/profile b/home/i3/profile deleted file mode 100644 index ca43a79c..00000000 --- a/home/i3/profile +++ /dev/null @@ -1,17 +0,0 @@ -[Groups/0] -# Group Name -Name=Other -# Layout -Default Layout=us -# Default Input Method -DefaultIM=rime - -[Groups/0/Items/0] -# Name -Name=rime -# Layout -Layout= - -[GroupOrder] -0=Other -