Skip to content

Commit

Permalink
Move from a hacky direnv cache to nix-direnv plugin
Browse files Browse the repository at this point in the history
I've been using a hacked up caching speedup of direnv for a while now:
https://gist.github.com/zimbatm/77bfa0268b5a2a540c4d0d9189bb1ae2

But now I've realized that a similar approach has been released as a proper
plugin and is available in 20.03 nixpkgs, so this commit removes the old
hack and replaces it with the shiny new `nix-direnv` plugin.

More info on https://github.com/nix-community/nix-direnv/

Also, had to update to latest 20.03 nixpkgs to be able to install `nix-direnv`.
  • Loading branch information
zupo committed Aug 8, 2020
1 parent 7211acc commit b775955
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .direnvrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if [ -f /run/current-system/sw/share/nix-direnv/direnvrc ]; then
source /run/current-system/sw/share/nix-direnv/direnvrc
fi
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ $ ln -sv ~/.dotfiles/.hushlogin ~/
$ ln -sv ~/.dotfiles/.gitignore ~/
$ ln -sv ~/.dotfiles/.gitattributes ~/
$ ln -sv ~/.dotfiles/.vimrc ~/.vimrc
$ ln -sv ~/.dotfiles/darwin-configuration.nix ~/.nixpkgs/darwin-configuration.nix
$ ln -sv ~/.dotfiles/.vimrc ~/.vimrc
$ ln -sv ~/.dotfiles/direnvrc ~/.config/direnv/direnvrc
$ ln -sv ~/.dotfiles/.direnvrc ~/.direnvrc
$ ln -sv ~/.dotfiles/darwin-configuration.nix ~/.nixpkgs/darwin-configuration.nix
$ mv ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User.bak
$ ln -sv ~/.dotfiles/sublime ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
Expand Down
12 changes: 11 additions & 1 deletion darwin-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

{


# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
Expand Down Expand Up @@ -75,6 +74,17 @@
pkgs.vim
pkgs.wget
pkgs.youtube-dl
pkgs.nix-direnv
];

# Support for https://github.com/nix-community/nix-direnv
# nix options for derivations to persist garbage collection
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
environment.pathsToLink = [
"/share/nix-direnv"
];

}
39 changes: 0 additions & 39 deletions direnvrc

This file was deleted.

6 changes: 3 additions & 3 deletions pins/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fetchTarball {
# https://github.com/NixOS/nixpkgs/tree/nixos-19.03 on 2020-05-10
url = "https://github.com/nixos/nixpkgs/archive/ab3adfe1c769c22b6629e59ea0ef88ec8ee4563f.tar.gz";
sha256 = "1m4wvrrcvif198ssqbdw897c8h84l0cy7q75lyfzdsz9khm1y2n1";
# https://github.com/NixOS/nixpkgs/tree/nixos-20.03 on 2020-08-08
url = "https://github.com/nixos/nixpkgs/archive/4364ff933ebec0ef856912b182f4f9272aa7f98f.tar.gz";
sha256 = "19ig1ywd2jq7qqzwpw6f1li90dq4kk3v0pbqgn6lzdabzf95bz6z";
}
4 changes: 2 additions & 2 deletions sublime/Preferences.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"schemas",
"niteoweb",
"Gunicorn",
"cachix"
"cachix",
"stylesheet"
],
"binary_file_patterns":
[
Expand Down Expand Up @@ -110,7 +111,6 @@
"nltk_data/",
"output/",
"parts/",
"poetry.lock",
"pip-selfcheck.json",
"selenium_screenshots/",
"share/",
Expand Down

0 comments on commit b775955

Please sign in to comment.