Hi everyone!
I am trying to configure my home-manager config so that it ports to multiple systems. I mainly use linux and mac. Thing is, I have run into an issue where some of the nix modules I import home.nix are not viable on mac.
To get around this I have tried to do something like this:
{ config, pkgs, ... }:
let darwin = pkgs.system == "x86_64-darwin";
in
let my_imports = if !darwin then [
./nixpkgs.nix
./alacritty.nix
./zsh.nix
./starship.nix
./tmux.nix
]
else [
./alacritty.nix
./zsh.nix
./starship.nix
./tmux.nix
];
# ...
in
{
imports = my_imports;
# ...
}
This is definitely a “new” user type question, but I am getting this:
error:
… while evaluating a branch condition
at /nix/store/riqkpszjqk02bi1wppfg8ip5xvh102qd-source/lib/lists.nix:125:9:
124| fold' = n:
125| if n == len
| ^
126| then nul
… while calling the 'length' builtin
at /nix/store/riqkpszjqk02bi1wppfg8ip5xvh102qd-source/lib/lists.nix:123:13:
122| let
123| len = length list;
| ^
124| fold' = n:
(stack trace truncated; use '--show-trace' to show the full trace)
error: infinite recursion encountered
at /nix/store/riqkpszjqk02bi1wppfg8ip5xvh102qd-source/lib/modules.nix:515:28:
514| addErrorContext (context name)
515| (args.${name} or config._module.args.${name})
| ^
516| ) (functionArgs f);
Now I figure that it’s because it’s evaluating the same modules over and over again or something like that. My question: what’s the best way to get around this?