diff --git a/.envrc.example b/.envrc.example new file mode 100644 index 000000000..58527a766 --- /dev/null +++ b/.envrc.example @@ -0,0 +1,2 @@ +use flake . --impure --allow-dirty --no-write-lock-file +build_channels_dir diff --git a/README.md b/README.md index 8f7ddf499..098874150 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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.