Skip to content

Commit

Permalink
direnv: provide example config, update Readme
Browse files Browse the repository at this point in the history
The recommended direnv config is now shipped as an example file,
allowing to just copy it for using. Readme is updated accordingly.

The recommended NixOS config for direnv now uses the recommended nix-community use_flake
hook as well.
  • Loading branch information
osnyx committed Aug 28, 2024
1 parent 0f84258 commit f91f71b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake . --impure --allow-dirty --no-write-lock-file
build_channels_dir
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ Automatically enter the dev shell with direnv

Use `direnv` to automatically enter the dev shell when you change to the fc-nixos directory.

A recommended direnv config is shipped in `.envrc.example` to use it in your repo checkout just
`cp .envrc{.example,} && direnv allow`.

We recommend the usage of the [nix-community/nix-direnv](https://github.com/nix-community/nix-direnv) hook
instead of the one shipped by direnv itself.
To set it up with `home-manager`, see:
https://github.com/nix-community/nix-direnv?tab=readme-ov-file#via-home-manager

Without home-manager
--------------------
### Without home-manager

On a NixOS machine, enabling `programs.direnv.enable` should be enough.

Expand All @@ -54,18 +58,14 @@ Add `/etc/local/nixos/dev_vm.nix`, for example:
nix.extraOptions = ''
keep-outputs = true
'';
programs.direnv.enable = true;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

Rebuild the system, close the shell/tmux session and log in again.

In `fc-nixos`, add an `.envrc` file like:

use flake . --impure --allow-dirty
build_channels_dir

Then, run `direnv allow` to build and enter the dev shell.

Run `direnv allow` again if the dev shell disappears or doesn't reload automatically.


Expand Down

0 comments on commit f91f71b

Please sign in to comment.