Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect existing _nix_direnv_manual_reload #516

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

JoaquinTrinanes
Copy link
Contributor

It's only initialized to 0 if it's not already set.

This fixes a niche-ish direnv use-case: I have nix_direnv_manual_reload set globally (inside my direnvrc config file). It works, but if I have nested envfiles it will be disabled (unless specified again). This can also be triggered by having nix_direnv_manual_reload on the nested .envrc but not on the outer one.

MWE

cd "$(mktemp -d)"

echo $'
{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
  outputs =
    { nixpkgs, ... }:
    let
      forEachSystem =
        f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.system);
    in
    {
      devShells = forEachSystem (pkgs: {
        default = pkgs.mkShell { };
      });
    };

}' >flake.nix
echo 'use flake' >.envrc

mkdir inner
echo $'
nix_direnv_manual_reload
source_up
' >./inner/.envrc
cd inner
direnv allow # manual reload not set

@bbenne10
Copy link
Contributor

This LGTM, but have not tested. Generally unavailable until Monday, so may not test until then.

@Mic92 Mic92 merged commit e796476 into nix-community:master Sep 3, 2024
32 checks passed
@JoaquinTrinanes JoaquinTrinanes deleted the fix/keep-manual-reload branch September 4, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants