digga icon indicating copy to clipboard operation
digga copied to clipboard

Inconsistent behaviour when accessing `self.lib` in different places

Open danielphan2003 opened this issue 3 years ago • 0 comments

Expected Behavior

Accessing self.lib should not throw infinite recursion.

Current Behavior

In flake.nix, with

lib = import ./lib.nix {lib = digga.lib // nixpkgs.lib;};
home = ./home.nix
nixos = ./nixos.nix

and nixos.nix refer to a function made in lib.nix via self.lib, it throws infinite recursion.

This is not the case for home.nix through, and I created a repo to reproduce.

Possible Solution

As a workaround, specify self explicitly when importing nixos.nix, e.g

nixos = import ./nixos.nix {inherit self;}

Steps to Reproduce

  1. Clone https://github.com/danielphan2003/digga-errors
  2. Run nixos-rebuild switch --flake .#NixOS Try comment out line 9 of nixos.nix and see the difference.

danielphan2003 avatar Jul 27 '22 05:07 danielphan2003