mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-12 19:27:17 +00:00
breakout zsh config
This commit is contained in:
parent
c2abe22da4
commit
39d8c87344
2 changed files with 102 additions and 109 deletions
|
@ -101,115 +101,6 @@
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
zsh = rec {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
autocd = true;
|
|
||||||
defaultKeymap = "emacs";
|
|
||||||
dotDir = ".config/zsh";
|
|
||||||
enableAutosuggestions = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
enableSyntaxHighlighting = true;
|
|
||||||
enableVteIntegration = true;
|
|
||||||
|
|
||||||
initExtraBeforeCompInit = ''
|
|
||||||
fpath+=(${config.home.profileDirectory}/share/zsh/site-functions)
|
|
||||||
'';
|
|
||||||
|
|
||||||
history = {
|
|
||||||
path = "$HOME/.local/zsh/history";
|
|
||||||
extended = true;
|
|
||||||
ignoreDups = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
historySubstringSearch.enable = true;
|
|
||||||
|
|
||||||
loginExtra = ''
|
|
||||||
# -*-sh-*-
|
|
||||||
export GPG_TTY=$(tty)
|
|
||||||
eval $(gpg-agent --daemon -q 2>/dev/null)
|
|
||||||
function s() {
|
|
||||||
${shellAliases.web} "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')"
|
|
||||||
}
|
|
||||||
nixify() {
|
|
||||||
if [ ! -e ./.envrc ]; then
|
|
||||||
echo "use nix" > .envrc
|
|
||||||
direnv allow
|
|
||||||
fi
|
|
||||||
if [[ ! -e shell.nix ]] && [[ ! -e default.nix ]]; then
|
|
||||||
cat > default.nix <<'EOF'
|
|
||||||
with import <nixpkgs> {};
|
|
||||||
mkShell {
|
|
||||||
nativeBuildInputs = [
|
|
||||||
bashInteractive
|
|
||||||
];
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
${config.home.sessionVariables.EDITOR} default.nix
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
nixifypy() {
|
|
||||||
if [ ! -e ./.envrc ]; then
|
|
||||||
echo "use nix" > .envrc
|
|
||||||
direnv allow
|
|
||||||
fi
|
|
||||||
if [[ ! -e shell.nix ]] && [[ ! -e default.nix ]]; then
|
|
||||||
cat > default.nix <<'EOF'
|
|
||||||
with import <nixpkgs> {};
|
|
||||||
mkShell {
|
|
||||||
nativeBuildInputs = [
|
|
||||||
bashInteractive
|
|
||||||
(pkgs.python310.withPackages (p: with p; [ ]))
|
|
||||||
];
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
${config.home.sessionVariables.EDITOR} default.nix
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
flakify() {
|
|
||||||
if [ ! -e flake.nix ]; then
|
|
||||||
nix flake new -t github:nix-community/nix-direnv .
|
|
||||||
elif [ ! -e .envrc ]; then
|
|
||||||
echo "use flake" > .envrc
|
|
||||||
direnv allow
|
|
||||||
fi
|
|
||||||
${config.home.sessionVariables.EDITOR} flake.nix
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
localVariables = {
|
|
||||||
PROMPT = "\n%B%F{blue}%~\n%F{green}$ %f%b";
|
|
||||||
RPROMPT = "%B%F{red}%*%f%b";
|
|
||||||
};
|
|
||||||
|
|
||||||
shellAliases =
|
|
||||||
rec {
|
|
||||||
cd = "z";
|
|
||||||
discord = "${web} https://discord.com/channels/@me";
|
|
||||||
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
|
|
||||||
e = "emacsclient -c -nw";
|
|
||||||
em = "emacs -nw";
|
|
||||||
email = "${ew} -n --eval '(mu4e)'";
|
|
||||||
emw = "emacs";
|
|
||||||
ew = "emacsclient -c";
|
|
||||||
l = "ls -1";
|
|
||||||
np = "nix-shell -p";
|
|
||||||
org = "cd ${config.home.sessionVariables.ORGDIR} ";
|
|
||||||
spotify = "${web} https://open.spotify.com/";
|
|
||||||
ubc = "cd ${config.home.sessionVariables.UBCDIR} ";
|
|
||||||
ubcmail = "${web} https://webmail.student.ubc.ca";
|
|
||||||
web = "${pkgs.coreutils-full}/bin/nohup ${config.programs.firefox.package}/bin/firefox &> ${config.home.homeDirectory}/.firefox.log";
|
|
||||||
}
|
|
||||||
// (
|
|
||||||
if pkgs.stdenv.isLinux
|
|
||||||
then {
|
|
||||||
nbs = "sudo nixos-rebuild build --flake ${config.home.sessionVariables.DOTDIR}#";
|
|
||||||
nrs = "sudo nixos-rebuild switch --flake ${config.home.sessionVariables.DOTDIR}#";
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
102
home-manager/modules/profiles/user/willem/programs/zsh.nix
Normal file
102
home-manager/modules/profiles/user/willem/programs/zsh.nix
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
programs.zsh = rec {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
autocd = true;
|
||||||
|
defaultKeymap = "emacs";
|
||||||
|
dotDir = ".config/zsh";
|
||||||
|
enableAutosuggestions = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
enableSyntaxHighlighting = true;
|
||||||
|
enableVteIntegration = true;
|
||||||
|
|
||||||
|
initExtraBeforeCompInit = ''
|
||||||
|
fpath+=(${config.home.profileDirectory}/share/zsh/site-functions)
|
||||||
|
'';
|
||||||
|
|
||||||
|
history = {
|
||||||
|
path = "$HOME/.local/zsh/history";
|
||||||
|
extended = true;
|
||||||
|
ignoreDups = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
historySubstringSearch.enable = true;
|
||||||
|
|
||||||
|
loginExtra =
|
||||||
|
/*
|
||||||
|
sh
|
||||||
|
*/
|
||||||
|
''
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
|
function s() {
|
||||||
|
${shellAliases.web} "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')"
|
||||||
|
}
|
||||||
|
|
||||||
|
nixifypy() {
|
||||||
|
if [ ! -e ./.envrc ]; then
|
||||||
|
echo "use nix" > .envrc
|
||||||
|
direnv allow
|
||||||
|
fi
|
||||||
|
if [[ ! -e shell.nix ]] && [[ ! -e default.nix ]]; then
|
||||||
|
cat > default.nix <<'EOF'
|
||||||
|
with import <nixpkgs> {};
|
||||||
|
mkShell {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
bashInteractive
|
||||||
|
(pkgs.python310.withPackages (p: with p; [ ]))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
${config.home.sessionVariables.EDITOR} default.nix
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
flakify() {
|
||||||
|
if [ ! -e flake.nix ]; then
|
||||||
|
nix flake new -t github:nix-community/nix-direnv .
|
||||||
|
elif [ ! -e .envrc ]; then
|
||||||
|
echo "use flake" > .envrc
|
||||||
|
direnv allow
|
||||||
|
fi
|
||||||
|
${config.home.sessionVariables.EDITOR} flake.nix
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
localVariables = {
|
||||||
|
PROMPT = "\n%B%F{blue}%~\n%F{green}$ %f%b";
|
||||||
|
RPROMPT = "%B%F{red}%*%f%b";
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAliases =
|
||||||
|
rec {
|
||||||
|
cd = "z";
|
||||||
|
discord = "${web} https://discord.com/channels/@me";
|
||||||
|
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
|
||||||
|
e = "emacsclient -c -nw";
|
||||||
|
em = "emacs -nw";
|
||||||
|
email = "${ew} -n --eval '(mu4e)'";
|
||||||
|
emw = "emacs";
|
||||||
|
ew = "emacsclient -c";
|
||||||
|
l = "ls -1";
|
||||||
|
np = "nix-shell -p";
|
||||||
|
org = "cd ${config.home.sessionVariables.ORGDIR} ";
|
||||||
|
spotify = "${web} https://open.spotify.com/";
|
||||||
|
ubc = "cd ${config.home.sessionVariables.UBCDIR} ";
|
||||||
|
ubcmail = "${web} https://webmail.student.ubc.ca";
|
||||||
|
web = "${pkgs.coreutils-full}/bin/nohup ${config.programs.firefox.package}/bin/firefox &> ${config.home.homeDirectory}/.firefox.log";
|
||||||
|
}
|
||||||
|
// (
|
||||||
|
if pkgs.stdenv.isLinux
|
||||||
|
then {
|
||||||
|
nbs = "sudo nixos-rebuild build --flake ${config.home.sessionVariables.DOTDIR}#";
|
||||||
|
nrs = "sudo nixos-rebuild switch --flake ${config.home.sessionVariables.DOTDIR}#";
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue