From 58b02a6b16b75e4f87d086ca061df06cbc9c10cd Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Wed, 20 Dec 2023 10:45:01 +0800 Subject: [PATCH] feat: replace home.activation.xxx via home.file..force --- home/base/server/git.nix | 2 +- home/darwin/rime-squirrel.nix | 15 ++++----------- home/linux/fcitx5/default.nix | 16 ++++++---------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/home/base/server/git.nix b/home/base/server/git.nix index 47c251f9..db40295a 100644 --- a/home/base/server/git.nix +++ b/home/base/server/git.nix @@ -11,7 +11,7 @@ # # https://git-scm.com/docs/git-config#Documentation/git-config.txt---global home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] '' - rm -f ~/.gitconfig + rm -f ${config.home.homeDirectory}/.gitconfig ''; home.packages = with pkgs; [ diff --git a/home/darwin/rime-squirrel.nix b/home/darwin/rime-squirrel.nix index 9c93af3f..77a55874 100644 --- a/home/darwin/rime-squirrel.nix +++ b/home/darwin/rime-squirrel.nix @@ -1,18 +1,11 @@ -{ - config, - lib, - pkgs, - ... -}: { - # remove existing rime data (squirrel) - home.activation.removeExistingRimeData = lib.hm.dag.entryBefore ["checkLinkTargets"] '' - rm -rf "${config.home.homeDirectory}/Library/Rime/build/flypy.prism.bin" - ''; - +{pkgs, ...}: { # Squirrel Input Method home.file."Library/Rime" = { # my custom squirrel data (flypy input method) source = "${pkgs.flypy-squirrel}/share/rime-data"; recursive = true; + # overwrite possible existing data dynamically generated by squirrel + # https://github.com/nix-community/home-manager/blob/release-23.05/modules/lib/file-type.nix#L101-L111 + force = true; }; } diff --git a/home/linux/fcitx5/default.nix b/home/linux/fcitx5/default.nix index c38b768f..cac348e7 100644 --- a/home/linux/fcitx5/default.nix +++ b/home/linux/fcitx5/default.nix @@ -1,23 +1,19 @@ { pkgs, - config, - lib, catppuccin-fcitx5, ... }: { - home.file.".config/fcitx5/profile".source = ./profile; + home.file.".config/fcitx5/profile" = { + source = ./profile; + # every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile, + # so we need to force replace it in every rebuild to avoid file conflict. + force = true; + }; # color schema home.file.".local/share/fcitx5/themes".source = "${catppuccin-fcitx5}/src"; home.file.".config/fcitx5/conf/classicui.conf".source = ./classicui.conf; - # every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile file, - # which will override my config managed by home-manager - # so we need to remove it before everytime we rebuild the config - home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] '' - rm -f "${config.xdg.configHome}/fcitx5/profile" - ''; - i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [