zsh: Add (nix-)direnv
This commit is contained in:
parent
a6c090e675
commit
d9de00e665
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -22,3 +22,6 @@
|
||||||
[submodule "zsh-nix-shell"]
|
[submodule "zsh-nix-shell"]
|
||||||
path = zsh-nix-shell
|
path = zsh-nix-shell
|
||||||
url = https://github.com/chisui/zsh-nix-shell
|
url = https://github.com/chisui/zsh-nix-shell
|
||||||
|
[submodule "nix-direnv"]
|
||||||
|
path = nix-direnv
|
||||||
|
url = https://github.com/nix-community/nix-direnv
|
||||||
|
|
1
home/.gitignore
vendored
1
home/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*.swp
|
*.swp
|
||||||
|
.direnv
|
||||||
Session.vim
|
Session.vim
|
||||||
|
|
1
home/.nix-direnv
Symbolic link
1
home/.nix-direnv
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../nix-direnv
|
|
@ -52,6 +52,27 @@ alias dynamic-colors="~/.dynamic-colors/bin/dynamic-colors"
|
||||||
## Support for nix-shell
|
## Support for nix-shell
|
||||||
source $HOME/.zsh/zsh-nix-shell/nix-shell.plugin.zsh
|
source $HOME/.zsh/zsh-nix-shell/nix-shell.plugin.zsh
|
||||||
|
|
||||||
|
# Per-directory environment
|
||||||
|
command -v direnv >/dev/null && eval "$(direnv hook zsh)"
|
||||||
|
|
||||||
|
nixify() {
|
||||||
|
if [ ! -e ./.envrc ]; then
|
||||||
|
echo "use nix" > .envrc
|
||||||
|
direnv allow
|
||||||
|
fi
|
||||||
|
if [[ ! -e shell.nix ]] && [[ ! -e default.nix ]]; then
|
||||||
|
cat > default.nix << EOF
|
||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
${EDITOR:-vim} default.nix
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
## Timer
|
## Timer
|
||||||
function timer() (
|
function timer() (
|
||||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||||
|
|
1
nix-direnv
Submodule
1
nix-direnv
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 300258e2bded28c284451f4fac8475b2240b46f6
|
Reference in a new issue