I am currently trying to create a shared config between my desktop and my laptop. In doing so I wanted to create a custom option with mkOption in my home.nix file to check which config files to fetch.
I have tried to create the custom option in my home.nix file as follows:
However I can’t seem to find a way to set the value of this option in another file. Trying to set it with config.dotfiles.isLaptop = true gives me an error message saying:
Module `/etc/nixos/configuration.nix' has an unsupported attribute `boot'. This is caused by introducing a top-level `config' or `options' attribute.
When I change the config to
config = {
dotfiles.isLaptop = true;
}
it tells me the option dotfiles does not exist.
Is what I am trying to do possible using nix or should I approach it differently?
Am I doing this correctly or do variables/options not work this way in nix? I import the file setting the option at the top of my configuration.nix file, home manager imports my home.nix where the option is declared later in configuration.nix.