Skip to content

Commit

Permalink
direnv + nix-direnv
Browse files Browse the repository at this point in the history
Signed-off-by: Colton J. McCurdy <mccurdyc22@gmail.com>
  • Loading branch information
mccurdyc committed Sep 18, 2022
1 parent 1ffbd1f commit 2504d7f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
5 changes: 0 additions & 5 deletions modules/packages/default.nix
Expand Up @@ -24,15 +24,10 @@ in {
gopls
hadolint
htop
hugo
jq
ngrok
niv
nodePackages.bash-language-server
nodePackages.dockerfile-language-server-nodejs
nodePackages.lua-fmt
nodePackages.webpack
nodePackages.webpack-cli
nodePackages.yaml-language-server
nodejs
pinentry-curses
Expand Down
12 changes: 12 additions & 0 deletions modules/system/configuration.nix
Expand Up @@ -10,8 +10,10 @@
services.xserver.desktopManager.xterm.enable = false;
programs.zsh.enable = true;
environment.systemPackages = with pkgs; [
direnv
git
mosh
nix-direnv
vim
wget
zsh
Expand All @@ -29,6 +31,7 @@
};
extraOptions = ''
experimental-features = nix-command flakes
# nix options for derivations to persist garbage collection
keep-outputs = true
keep-derivations = true
'';
Expand Down Expand Up @@ -67,6 +70,15 @@
EDITOR = "nvim";
};

environment.pathsToLink = [
"/share/nix-direnv"
];

# if you also want support for flakes
nixpkgs.overlays = [
(self: super: {nix-direnv = super.nix-direnv.override {enableFlakes = true;};})
];

# Lots of stuff that claims doesn't work, actually works.
nixpkgs.config = {
allowUnfree = true;
Expand Down
12 changes: 12 additions & 0 deletions modules/zsh/default.nix
Expand Up @@ -33,6 +33,17 @@ in {
gitfc = ''(){ git log --format=format:"%H" | tail -1 ;}'';
gp = "git push";
kubectl_pods_containers = ''kubectl get pods -o jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.name}{", "}{end}{end}' | sort'';
# https://github.com/nix-community/nix-direnv/wiki/Shell-integration
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
}
'';
};
history = {
size = 10000;
Expand Down Expand Up @@ -75,6 +86,7 @@ in {
setopt interactive_comments
setopt nobeep
eval "$(direnv hook zsh)"
eval "$(starship init zsh)"
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
Expand Down

0 comments on commit 2504d7f

Please sign in to comment.