mirror of
https://github.com/nix-community/home-manager
synced 2024-11-19 17:49:45 +01:00
antidote: static file move to /tmp
Make antidote create static file path with hm hash_id in /tmp.
This commit is contained in:
parent
b66af0ac66
commit
2f78e6fcba
2 changed files with 18 additions and 14 deletions
|
@ -8,11 +8,13 @@ let
|
|||
(optionalString (config.programs.zsh.dotDir != null)
|
||||
(config.programs.zsh.dotDir + "/")) + file;
|
||||
|
||||
zPluginStr = with lib;
|
||||
(pluginNames:
|
||||
optionalString (pluginNames != [ ]) "${concatStrings (map (name: ''
|
||||
${name}
|
||||
'') pluginNames)}");
|
||||
zPluginStr = (pluginNames:
|
||||
optionalString (pluginNames != [ ]) "${concatStrings (map (name: ''
|
||||
${name}
|
||||
'') pluginNames)}");
|
||||
|
||||
parseHashId = path:
|
||||
elemAt (builtins.match "/nix/store/([a-zA-Z0-9]+)-.*" path) 0;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.hitsmaxft ];
|
||||
|
||||
|
@ -33,20 +35,24 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.file."${relToDotDir ".zsh_plugins.txt"}".text = zPluginStr cfg.plugins;
|
||||
|
||||
### move zsh_plugins.txt
|
||||
programs.zsh.initExtraBeforeCompInit = ''
|
||||
programs.zsh.initExtraBeforeCompInit = let
|
||||
configFiles = pkgs.runCommand "hm_antidote-files" { } ''
|
||||
echo "${zPluginStr cfg.plugins}" > $out
|
||||
'';
|
||||
hashId = parseHashId "${configFiles}";
|
||||
in ''
|
||||
## home-manager/antidote begin :
|
||||
source ${cfg.package}/share/antidote/antidote.zsh
|
||||
${optionalString cfg.useFriendlyNames
|
||||
"zstyle ':antidote:bundle' use-friendly-names 'yes'"}
|
||||
bundlefile=$HOME/${relToDotDir ".zsh_plugins.txt"}
|
||||
|
||||
bundlefile=${configFiles}
|
||||
zstyle ':antidote:bundle' file $bundlefile
|
||||
staticfile=$HOME/${relToDotDir ".zsh_plugins.zsh"}
|
||||
staticfile=/tmp/tmp_hm_zsh_plugins.zsh-${hashId}
|
||||
zstyle ':antidote:static' file $staticfile
|
||||
|
||||
antidote load $bundlefile $staticfile
|
||||
|
||||
## home-manager/antidote end
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -24,7 +24,5 @@ in {
|
|||
'antidote load'
|
||||
assertFileContains home-files/${relToDotDirCustom}/.zshrc \
|
||||
"zstyle ':antidote:bundle' use-friendly-names 'yes'"
|
||||
assertFileContains home-files/${relToDotDirCustom}/.zsh_plugins.txt \
|
||||
'zsh-users/zsh-autosuggestions'
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue