feat: replace home.activation.xxx via home.file.<name>.force

This commit is contained in:
Ryan Yin
2023-12-20 10:45:01 +08:00
parent 29511fa574
commit 58b02a6b16
3 changed files with 11 additions and 22 deletions

View File

@@ -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; [

View File

@@ -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;
};
}

View File

@@ -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; [