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
Infinite Recursion With stdenv functions #414
Comments
I'm traveling and don't have time to think to hard so I will just hazard a guess at a solution. Try changing { pkgs, lib, ... }:
{
programs.home-manager.enable = true;
programs.home-manager.path = https://github.com/rycee/home-manager/master.tar.gz;
# programs.emacs.<everything_else> = <etc>; # and so on...
}
// (lib.optionalAttrs pkgs.stdenv.isLinux {
programs.emacs.enable = true;
})
// (lib.optionalAttrs pkgs.stdenv.isDarwin {
programs.emacs.enable = false;
}) to { pkgs, lib, ... }:
lib.mkMerge [
{
programs.home-manager.enable = true;
programs.home-manager.path = https://github.com/rycee/home-manager/master.tar.gz;
# programs.emacs.<everything_else> = <etc>; # and so on...
}
(lib.mkIf pkgs.stdenv.isLinux {
programs.emacs.enable = true;
})
(lib.mkIf pkgs.stdenv.isDarwin {
programs.emacs.enable = false;
})
] I think the use of |
Safe travels! I still have a lot to learn about Nix it appears: that worked great! Now for me to go and find out why... Thanks so much! |
No worries. Glad you like HM! 😀 |
I would love to understand why this causes an infinite recursion
|
@fzakaria The In other words, to evaluate Edit: Just to add some suggestion for alternative solution. I would suggest have a |
Regarding, infinite recursion, what if I want to use functions defined in
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/optionalattrs-in-module-infinite-recursion-with-config/27876/1 |
I've made use of
pkgs.stdenv.isDarwin
andpkgs.stdenv.isLinux
to produce a configuration that equally applies to my work MacOS machine and my personal NixOS machine. It's nice because changes that are not OS-specific automatically apply to each system. An example of a configuration that is working:But what I would like to do is the following, which would help me to remove all of the OS-specifics, especially
enable
parameters, to the same location instead of being spread throughout the configuration:This fails, however:
I'm still rather new to Nix so I get that I may have made some obvious scoping mistake, but I can't figure out what it would be.
The text was updated successfully, but these errors were encountered: