From e146cf6b8d9fde7b5f5193772e200fbea55a5ffe Mon Sep 17 00:00:00 2001 From: Dinghao Luo Date: Sat, 30 May 2026 21:34:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=E3=80=8C/=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configuration.nix | 14 ++++++--- flake.nix | 2 +- hardware-configuration.nix | 23 +++++++++----- home.nix | 62 ++++++++++++++++++++++++++------------ 4 files changed, 69 insertions(+), 32 deletions(-) diff --git a/configuration.nix b/configuration.nix index f889586..d708108 100644 --- a/configuration.nix +++ b/configuration.nix @@ -54,13 +54,18 @@ type = "fcitx5"; fcitx5.waylandFrontend = true; fcitx5.addons = with pkgs; [ - # 拼音输入 + KDE/Qt 集成 - qt6Packages.fcitx5-chinese-addons + fcitx5-rime fcitx5-gtk kdePackages.fcitx5-qt kdePackages.fcitx5-configtool ]; }; + environment.sessionVariables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + NIXOS_OZONE_WL = "1"; + }; # ── 桌面环境 (KDE Plasma 6 / Wayland) ─────────────────────── services.xserver.enable = true; @@ -114,9 +119,9 @@ services.flatpak.enable = true; # ── 用户 ──────────────────────────────────────────────────── - users.users.test = { + users.users.luodh = { isNormalUser = true; - description = "test"; + description = "luodh"; shell = pkgs.fish; extraGroups = [ "networkmanager" "wheel" ]; packages = with pkgs; [ @@ -142,6 +147,7 @@ zip unzip ffmpeg + librime ]; # ── 系统状态版本(请勿修改) ──────────────────────────────── diff --git a/flake.nix b/flake.nix index 6975d93..6845790 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ home-manager.sharedModules = [ plasma-manager.homeModules.plasma-manager ]; # ⚠️ 极其重要:把这里的 "luodh" 替换成你在 NixOS 里登录的实际系统用户名 - home-manager.users.test = import ./home.nix; + home-manager.users.luodh = import ./home.nix; } ]; diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 2407a92..cfb4097 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -4,20 +4,29 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = [ ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/a4dec1b6-8027-46c5-b143-0fc9ea1e2ef7"; - fsType = "ext4"; + { device = "/dev/disk/by-uuid/b818ea33-5c41-4eeb-b7b9-7e1e3397964f"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/b818ea33-5c41-4eeb-b7b9-7e1e3397964f"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/0115-3C19"; + { device = "/dev/disk/by-uuid/BF34-E3A0"; fsType = "vfat"; options = [ "fmask=0077" "dmask=0077" ]; }; @@ -25,5 +34,5 @@ swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - virtualisation.virtualbox.guest.enable = true; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/home.nix b/home.nix index ea0111e..888c7b6 100644 --- a/home.nix +++ b/home.nix @@ -2,8 +2,8 @@ { # ⚠️ 极其重要:替换成你的实际系统用户名 - home.username = "test"; - home.homeDirectory = "/home/test"; + home.username = "luodh"; + home.homeDirectory = "/home/luodh"; # 你的个人日常软件全写在这里! home.packages = with pkgs; [ @@ -29,25 +29,51 @@ nodejs pnpm kdePackages.kate + rime-ice + wemeet ]; - # 用 Home Manager 固定 Fcitx5 输入法配置,仅保留拼音 - home.file.".config/fcitx5/profile".text = '' - [Groups/0] - Name=Default - Default Layout=us - DefaultIM=pinyin + # Rime 输入法配置(雾凇拼音) + home.file.".local/share/fcitx5/rime/default.custom.yaml".text = '' + patch: + schema_list: + - schema: rime_ice + menu/page_size: 7 + ''; - [Groups/0/Items/0] - Name=keyboard-us - Layout= + xdg.configFile."fcitx5/profile" = { + force = true; + text = '' + [Groups/0] + Name=Default + Default Layout=us + DefaultIM=keyboard-us - [Groups/0/Items/1] - Name=pinyin - Layout= + [Groups/0/Items/0] + Name=keyboard-us + Layout= - [GroupOrder] - 0=Default + [Groups/0/Items/1] + Name=rime + Layout= + + [GroupOrder] + 0=Default + ''; + }; + + home.activation.setupRimeIce = config.lib.dag.entryAfter ["writeBoundary"] '' + RIME_DIR="$HOME/.local/share/fcitx5/rime" + mkdir -p "$RIME_DIR" + for item in ${pkgs.rime-data}/share/rime-data/*; do + name=$(basename "$item") + [ -e "$RIME_DIR/$name" ] || ln -sf "$item" "$RIME_DIR" + done + for item in ${pkgs.rime-ice}/share/rime-data/*; do + name=$(basename "$item") + [ -e "$RIME_DIR/$name" ] && rm -rf "$RIME_DIR/$name" + ln -sf "$item" "$RIME_DIR" + done ''; home.sessionPath = [ @@ -88,10 +114,6 @@ "XLbInptAccelProfileFlat" = true; # 平坦加速曲线 }; }; - - # 虚拟键盘 / 输入法设置为 fcitx5 - configFile."kwinrc"."Wayland"."InputMethod" = - "${pkgs.fcitx5}/share/applications/org.fcitx.Fcitx5.desktop"; }; # 这个版本号不要改!它不是软件版本,而是系统状态标识