mirror of
https://github.com/nix-community/home-manager
synced 2024-12-20 16:59:47 +01:00
antidote: add module
Antidote is a Zsh plugin manager.
This commit is contained in:
parent
b9046172a5
commit
70ac18872a
6 changed files with 95 additions and 0 deletions
|
@ -1125,6 +1125,14 @@ in
|
||||||
can control it by using the `qt5ct` and `qt6ct` applications;
|
can control it by using the `qt5ct` and `qt6ct` applications;
|
||||||
- `qt.style.name = "kvantum"`: override the style by using themes
|
- `qt.style.name = "kvantum"`: override the style by using themes
|
||||||
written in SVG. Supports many popular themes.
|
written in SVG. Supports many popular themes.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2023-06-17T22:18:22+00:00";
|
||||||
|
condition = config.programs.zsh.enable;
|
||||||
|
message = ''
|
||||||
|
A new modules is available: 'programs.zsh.antidote'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -51,6 +51,7 @@ let
|
||||||
./programs/afew.nix
|
./programs/afew.nix
|
||||||
./programs/alacritty.nix
|
./programs/alacritty.nix
|
||||||
./programs/alot.nix
|
./programs/alot.nix
|
||||||
|
./programs/antidote.nix
|
||||||
./programs/aria2.nix
|
./programs/aria2.nix
|
||||||
./programs/astroid.nix
|
./programs/astroid.nix
|
||||||
./programs/atuin.nix
|
./programs/atuin.nix
|
||||||
|
|
53
modules/programs/antidote.nix
Normal file
53
modules/programs/antidote.nix
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.programs.zsh.antidote;
|
||||||
|
|
||||||
|
relToDotDir = file:
|
||||||
|
(optionalString (config.programs.zsh.dotDir != null)
|
||||||
|
(config.programs.zsh.dotDir + "/")) + file;
|
||||||
|
|
||||||
|
zPluginStr = with lib;
|
||||||
|
(pluginNames:
|
||||||
|
optionalString (pluginNames != [ ]) "${concatStrings (map (name: ''
|
||||||
|
${name}
|
||||||
|
'') pluginNames)}");
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ maintainers.hitsmaxft ];
|
||||||
|
|
||||||
|
options.programs.zsh.antidote = {
|
||||||
|
enable = mkEnableOption "antidote - a zsh plugin manager";
|
||||||
|
|
||||||
|
plugins = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [ "zsh-users/zsh-autosuggestions" ];
|
||||||
|
description = "List of antidote plugins.";
|
||||||
|
};
|
||||||
|
|
||||||
|
useFriendlyNames = mkEnableOption "friendly names";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "antidote" { };
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = ''
|
||||||
|
## home-manager/antidote begin :
|
||||||
|
source ${cfg.package}/antidote.zsh
|
||||||
|
${optionalString cfg.useFriendlyNames
|
||||||
|
"zstyle ':antidote:bundle' use-friendly-names 'yes'"}
|
||||||
|
bundlefile=${relToDotDir ".zsh_plugins.txt"}
|
||||||
|
zstyle ':antidote:bundle' file $bundlefile
|
||||||
|
staticfile=${relToDotDir ".zsh_plugins.zsh"}
|
||||||
|
zstyle ':antidote:static' file $staticfile
|
||||||
|
antidote load $bundlefile $staticfile
|
||||||
|
## home-manager/antidote end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -57,6 +57,7 @@ import nmt {
|
||||||
./modules/programs/aerc
|
./modules/programs/aerc
|
||||||
./modules/programs/alacritty
|
./modules/programs/alacritty
|
||||||
./modules/programs/alot
|
./modules/programs/alot
|
||||||
|
./modules/programs/antidote
|
||||||
./modules/programs/aria2
|
./modules/programs/aria2
|
||||||
./modules/programs/atuin
|
./modules/programs/atuin
|
||||||
./modules/programs/autojump
|
./modules/programs/autojump
|
||||||
|
|
31
tests/modules/programs/antidote/antidote.nix
Normal file
31
tests/modules/programs/antidote/antidote.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
let relToDotDirCustom = ".zshplugins";
|
||||||
|
|
||||||
|
in {
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
dotDir = relToDotDirCustom;
|
||||||
|
antidote = {
|
||||||
|
enable = true;
|
||||||
|
useFriendlyNames = true;
|
||||||
|
plugins = [ "zsh-users/zsh-autosuggestions" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs = {
|
||||||
|
antidote = { };
|
||||||
|
zsh = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContains home-files/${relToDotDirCustom}/.zshrc \
|
||||||
|
'source @antidote@/antidote.zsh'
|
||||||
|
assertFileContains home-files/${relToDotDirCustom}/.zshrc \
|
||||||
|
'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'
|
||||||
|
'';
|
||||||
|
}
|
1
tests/modules/programs/antidote/default.nix
Normal file
1
tests/modules/programs/antidote/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ antidote-program = ./antidote.nix; }
|
Loading…
Reference in a new issue