Skip to content

Conversation

sternenseemann
Copy link
Member

The set environment variable leaks relatively easily leading to unexpected behavior when, for example, running nix-build from a shell or direnv environment. Nix 2.4 has provided an alternative mechanism for this which doesn't exhibit this flaw.

NixOS/nix#3168
NixOS/nixpkgs#436814
NixOS/nixpkgs#9438

Copy link
Member

@maralorn maralorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly a breaking change for people who use a wrapper around the generated derivation.

@sternenseemann
Copy link
Member Author

Unless people have assert builtins.length (builtins.attrNames (builtins.functionArgs (import ./shell.nix))) == 3; in their expressions, we're probably fine.

@maralorn
Copy link
Member

Really? I thought this autocalling only works when the function is the attribute passed to nix-shell. When however someone has a wrapper around their default.nix file, e.g. to pass in a pinned nixpkgs they would need to modify that wrapper to pass through that argument. don’t they?

The set environment variable leaks relatively easily leading to
unexpected behavior when, for example, running nix-build from a shell or
direnv environment. Nix 2.4 has provided an alternative mechanism for
this which doesn't exhibit this flaw.

NixOS/nix#3168
NixOS/nixpkgs#436814
NixOS/nixpkgs#9438
@sternenseemann sternenseemann force-pushed the cabal2nix-auto-call-in-nix-shell branch from 7b6fddf to f1f3641 Compare August 29, 2025 12:53
@sternenseemann
Copy link
Member Author

That's true. I've clarified that in the changelog entry. I don't think it's a big deal because I don't believe anyone is doing that and automatically generating the expression via ifd (hopefully).

@sternenseemann sternenseemann merged commit a63697c into master Aug 30, 2025
8 checks passed
@sternenseemann sternenseemann deleted the cabal2nix-auto-call-in-nix-shell branch August 30, 2025 00:42
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.

2 participants