feat(zsh): use atuin, better xdg, lint zsh
This commit is contained in:
parent
817e3f8e09
commit
7f4ec84c49
6 changed files with 70 additions and 55 deletions
|
@ -36,8 +36,8 @@
|
||||||
# konf
|
# konf
|
||||||
source <(konf-go shellwrapper zsh)
|
source <(konf-go shellwrapper zsh)
|
||||||
source <(konf-go completion zsh)
|
source <(konf-go completion zsh)
|
||||||
# open last konf on new shell session, only if konf store has been initialized
|
# ignore if konf store hasn't been initialized
|
||||||
[[ -d ~/.kube/konfs/store ]] && export KUBECONFIG=$(konf-go --silent set -)
|
export KUBECONFIG=$(konf-go --silent set - || true)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
}: {
|
}: {
|
||||||
programs.wezterm = {
|
programs.wezterm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.nur.repos.nekowinston.wezterm-nightly;
|
# package = pkgs.nur.repos.nekowinston.wezterm-nightly;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
package.path = "${flakePath}/home/apps/wezterm/?.lua;" .. package.path;
|
package.path = "${flakePath}/home/apps/wezterm/?.lua;" .. package.path;
|
||||||
return require("config")
|
return require("config")
|
||||||
|
|
|
@ -9,8 +9,21 @@
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${flakePath}/${fileName}";
|
source = config.lib.file.mkOutOfStoreSymlink "${flakePath}/${fileName}";
|
||||||
recursive = recursive;
|
recursive = recursive;
|
||||||
};
|
};
|
||||||
|
zshPlugins = plugins: (map (plugin: rec {
|
||||||
|
name = src.name;
|
||||||
|
inherit (plugin) file src;
|
||||||
|
})
|
||||||
|
plugins);
|
||||||
in {
|
in {
|
||||||
programs = {
|
programs = {
|
||||||
|
atuin = {
|
||||||
|
enable = true;
|
||||||
|
flags = ["--disable-up-arrow"];
|
||||||
|
settings = {
|
||||||
|
inline_height = 30;
|
||||||
|
style = "compact";
|
||||||
|
};
|
||||||
|
};
|
||||||
bat.enable = true;
|
bat.enable = true;
|
||||||
btop = {
|
btop = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -38,7 +51,6 @@ in {
|
||||||
enableAliases = true;
|
enableAliases = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
mcfly.enable = true;
|
|
||||||
nix-index.enable = true;
|
nix-index.enable = true;
|
||||||
|
|
||||||
starship = {
|
starship = {
|
||||||
|
@ -71,16 +83,15 @@ in {
|
||||||
initExtra = let
|
initExtra = let
|
||||||
functionsDir = "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/functions";
|
functionsDir = "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/functions";
|
||||||
in ''
|
in ''
|
||||||
for conf in "${functionsDir}"/**/*.zsh; do
|
for script in "${functionsDir}"/**/*; do
|
||||||
source "$conf"
|
source "$script"
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
envExtra = ''
|
||||||
sessionVariables = {
|
export LESSHISTFILE="-"
|
||||||
ZVM_INIT_MODE = "sourcing";
|
export ZVM_INIT_MODE="sourcing"
|
||||||
ZVM_CURSOR_BLINKING_BEAM = "1";
|
export ZVM_CURSOR_BLINKING_BEAM="1"
|
||||||
LESSHISTFILE = "-";
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
dotDir = ".config/zsh";
|
dotDir = ".config/zsh";
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
|
@ -94,35 +105,30 @@ in {
|
||||||
"kubectl"
|
"kubectl"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
plugins = [
|
plugins = with pkgs; (zshPlugins [
|
||||||
{
|
{
|
||||||
name = "zsh-fast-syntax-highlighting";
|
src = zsh-vi-mode;
|
||||||
src = pkgs.zsh-fast-syntax-highlighting;
|
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
|
||||||
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "zsh-nix-shell";
|
src = zsh-nix-shell;
|
||||||
src = pkgs.zsh-nix-shell;
|
|
||||||
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
|
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "zsh-vi-mode";
|
src = zsh-fast-syntax-highlighting;
|
||||||
src = pkgs.zsh-vi-mode;
|
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
||||||
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
|
|
||||||
}
|
}
|
||||||
];
|
]);
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
cat =
|
cat =
|
||||||
if isDarwin
|
if isDarwin
|
||||||
then "bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo Catppuccin-mocha || echo Catppuccin-latte)"
|
then "bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo Catppuccin-mocha || echo Catppuccin-latte)"
|
||||||
else "bat";
|
else "bat";
|
||||||
# switch between yubikeys for the same GPG key
|
# switch between yubikeys for the same GPG key
|
||||||
switch_yubikeys = "gpg-connect-agent \"scd serialno\" \"learn --force\" /bye";
|
switch_yubikeys = ''gpg-connect-agent "scd serialno" "learn --force" "/bye"'';
|
||||||
tree = "lsd --tree";
|
tree = "lsd --tree";
|
||||||
};
|
};
|
||||||
history = {
|
history.path = "${config.xdg.configHome}/zsh/history";
|
||||||
path = "${config.xdg.configHome}/zsh/history";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# vim:ft=zsh
|
||||||
local MAPPINGS='
|
local MAPPINGS='
|
||||||
video/3gpp,3gp
|
video/3gpp,3gp
|
||||||
video/3gpp2,3g2
|
video/3gpp2,3g2
|
||||||
|
@ -35,8 +36,8 @@ function icat() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -t 0 ]; then
|
if [ ! -t 0 ]; then
|
||||||
input="$(cat - | base64)"
|
local input="$(cat - | base64)"
|
||||||
headers="$(echo "$input" | base64 -d | file - --mime-type | cut -d " " -f2-)"
|
local headers="$(echo "$input" | base64 -d | file - --mime-type | cut -d " " -f2-)"
|
||||||
|
|
||||||
case $headers in
|
case $headers in
|
||||||
*svg*) echo "$input" | base64 -d | displaySVG ;;
|
*svg*) echo "$input" | base64 -d | displaySVG ;;
|
12
home/apps/zsh/functions/incognito
Normal file
12
home/apps/zsh/functions/incognito
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# vim:ft=zsh
|
||||||
|
function incognito() {
|
||||||
|
if [[ -n $ZSH_INCOGNITO ]]; then
|
||||||
|
add-zsh-hook precmd _atuin_precmd
|
||||||
|
add-zsh-hook preexec _atuin_preexec
|
||||||
|
unset ZSH_INCOGNITO
|
||||||
|
else
|
||||||
|
add-zsh-hook -d precmd _atuin_precmd
|
||||||
|
add-zsh-hook -d preexec _atuin_preexec
|
||||||
|
export ZSH_INCOGNITO=1
|
||||||
|
fi
|
||||||
|
}
|
50
home/xdg.nix
50
home/xdg.nix
|
@ -6,50 +6,46 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||||
|
inherit (config.xdg) cacheHome configHome dataHome;
|
||||||
|
inherit (config.home) homeDirectory;
|
||||||
in {
|
in {
|
||||||
home = {
|
home = rec {
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
AZURE_CONFIG_DIR = "${config.xdg.configHome}/azure";
|
AZURE_CONFIG_DIR = "${configHome}/azure";
|
||||||
CARGO_HOME = "${config.xdg.dataHome}/cargo";
|
CARGO_HOME = "${dataHome}/cargo";
|
||||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse";
|
CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse";
|
||||||
CARGO_UNSTABLE_SPARSE_REGISTRY = "true";
|
CARGO_UNSTABLE_SPARSE_REGISTRY = "true";
|
||||||
CUDA_CACHE_PATH = "${config.xdg.dataHome}/nv";
|
CUDA_CACHE_PATH = "${dataHome}/nv";
|
||||||
DOCKER_CONFIG = "${config.xdg.configHome}/docker";
|
DOCKER_CONFIG = "${configHome}/docker";
|
||||||
GEM_HOME = "${config.xdg.dataHome}/gem";
|
GEM_HOME = "${dataHome}/gem";
|
||||||
GEM_SPEC_CACHE = "${config.xdg.cacheHome}/gem";
|
GEM_SPEC_CACHE = "${cacheHome}/gem";
|
||||||
GOPATH = "${config.xdg.dataHome}/go";
|
GOPATH = "${dataHome}/go";
|
||||||
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
|
NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc";
|
||||||
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
|
NODE_REPL_HISTORY = "${dataHome}/node_repl_history";
|
||||||
XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompose";
|
RUSTUP_HOME = "${dataHome}/rustup";
|
||||||
|
WINEPREFIX = "${dataHome}/wine";
|
||||||
|
XCOMPOSECACHE = "${cacheHome}/X11/xcompose";
|
||||||
};
|
};
|
||||||
sessionPath = [
|
sessionPath = [
|
||||||
"$HOME/.local/bin"
|
"$HOME/.local/bin"
|
||||||
"${config.xdg.dataHome}/krew/bin"
|
"${dataHome}/krew/bin"
|
||||||
"${config.home.sessionVariables.GOPATH}/bin"
|
"${sessionVariables.GOPATH}/bin"
|
||||||
"${config.home.sessionVariables.CARGO_HOME}/bin"
|
"${sessionVariables.CARGO_HOME}/bin"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
home.activation.npmrc_xdg = ''
|
|
||||||
export NPM_CONFIG_USERCONFIG="${config.home.sessionVariables.NPM_CONFIG_USERCONFIG}"
|
|
||||||
${pkgs.nodejs + "/bin/npm"} config set \
|
|
||||||
prefix="${config.xdg.dataHome}/npm" \
|
|
||||||
cache="${config.xdg.cacheHome}/npm" \
|
|
||||||
init-module="${config.xdg.configHome}/npm/config/npm-init.js"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# NOTE: workaround for gpgme on Darwin, since GUI apps aren't aware of $GNUPGHOME
|
# NOTE: workaround for gpgme on Darwin, since GUI apps aren't aware of $GNUPGHOME
|
||||||
programs.gpg.homedir =
|
programs.gpg.homedir =
|
||||||
if isDarwin
|
if isDarwin
|
||||||
then "${config.home.homeDirectory}/.gnupg"
|
then "${homeDirectory}/.gnupg"
|
||||||
else "${config.xdg.configHome}/gnupg";
|
else "${configHome}/gnupg";
|
||||||
|
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userDirs.enable = isLinux;
|
userDirs.enable = isLinux;
|
||||||
cacheHome = "${config.home.homeDirectory}/.cache";
|
cacheHome = "${homeDirectory}/.cache";
|
||||||
configHome = "${config.home.homeDirectory}/.config";
|
configHome = "${homeDirectory}/.config";
|
||||||
dataHome = "${config.home.homeDirectory}/.local/share";
|
dataHome = "${homeDirectory}/.local/share";
|
||||||
mimeApps = {
|
mimeApps = {
|
||||||
enable = isLinux;
|
enable = isLinux;
|
||||||
defaultApplications = {
|
defaultApplications = {
|
||||||
|
|
Loading…
Reference in a new issue