I’m currently trying to make a module compatible with NixOS configuration.nix and with home-manager’s home.nix.
The only difference I have is when adding the package. With NixOS I use environment.systemPackages = [my_pkg] while with home-manager I use home.packages = [my_pkg].
Thank you ! It indeed solved the infinite recursion encountered (I still do not really understand why it behaved this way ?).
I now have the following issue :
The option `environment' defined in `/home/ely/test.nix' does not exist.
I have the feeling that the mkIf expression is still evaluated even if the flag is set, right ? If it does, is there a way to get around this limitation ?
I have the feeling that the mkIf expression is still evaluated even if the flag is set, right
right.
So what can be done:
you may set _module.check = false;, then it won’t complain about this kind of problems. It is bad, because when you do typos in option names, it won’t detect those typos
you may add an explicit variable load. For example, add to each module: let home-manager = builtins.getEnv "IS_HOME_MANAGER_EVAL" == "yes"; in
This way resolving home-manager doesn’t require module system eval, so it won’t cause infinite recursion. Now all you have to do is export IS_HOME_MANAGER_EVAL=yes before home-manager rebuilds.
best is to split system config and home configs and don’t try to mix that