No description
Find a file
2024-08-17 09:36:21 -04:00
.github/workflows Add github workflow to proxy tests from sr.ht 2024-01-13 09:32:09 -05:00
bin Filter missing watches before hashing 2024-08-17 09:36:21 -04:00
lib Filter missing watches before hashing 2024-08-17 09:36:21 -04:00
tests Filter missing watches before hashing 2024-08-17 09:36:21 -04:00
.envrc Add default.nix to direnv watches 2024-08-16 07:36:38 -04:00
.gitignore Add pre-commit-hooks.nix integration 2024-03-13 15:51:47 -04:00
.ocamlformat Update flake and conventions for 24.05+ 2024-08-08 08:08:58 -04:00
default.nix Fix a comment in default.nix 2024-08-16 07:45:55 -04:00
direnvrc Run shellcheck on direnvrc during checkPhase 2024-08-11 12:18:57 -04:00
dune-project Reduce dune version to work with Nix 23.11 2024-03-13 16:03:29 -04:00
dune-workspace Update flake and conventions for 24.05+ 2024-08-08 08:08:58 -04:00
flake.lock Update flake.lock 2024-08-11 12:14:41 -04:00
flake.nix Update flake and conventions for 24.05+ 2024-08-08 08:08:58 -04:00
flake_env.opam Reduce dune version to work with Nix 23.11 2024-03-13 16:03:29 -04:00
Justfile Instrument with bisect_ppx only conditionally 2024-08-08 08:08:58 -04:00
LICENSE Initial commit 2023-12-21 09:36:09 -05:00
README.md Add note about justfile in readme 2024-01-08 15:43:53 -05:00

flake_env

Yet another direnv plugin for flakes. This one is kind of experimental.

Why not nix-direnv?

I am one of the core contributors on nix_direnv, but wanted to try a new approach.

nix-direnv got held up a bit by depending on differing behaviors of external programs not shipped with bash (or things that are shipped with bash, but a differing implementation ended up in front of the bash version in PATH).

This is an attempt to simplify a bit. I ported the nix-direnv use_flake function to ReasonML. Implementing most things by hand in ReasonML is pretty simple and (more importantly) portable. This removes most of the dependencies besides bash and nix. The bash that exists is pretty portable between versions, since it only does environment manipulation.

Installation & Usage

Installation

These details are evolving. I'll make sure to update this document when things change.

For now, there is no NixOS, nix-darwin, or home-manager module that points at this tool. The only thing you can really do is use this repo's flake as an input. Then you'll probably need to source ${flake_env}/share/flake_env/direnvrc. You should be able to do that with:

  • programs.direnv.direnvrcExtra on NixOS
  • programs.direnv.stdlib if using home-manager

Usage

Example .envrc:

watch_file **/*.nix
use flake_env .

Developing

This repo uses just to manage simple build jobs. After activating the development environment in the repo, run just -l to list tasks.

Please remember to format code before issuing patches.

Credits

This takes huge inspiration (and literal code-chunks) from nix-direnv. Thanks to Mic92 for nix-direnv and kingarrrt for their recent contributions.