Closed SerhiyMakarenko closed 2 years ago
When I'm trying to run
darwin-rebuild switch
I get the following error:[22:54] serhiy_makarenko [/Users/serhiy_makarenko] > darwin-rebuild switch building the system configuration... error: You're trying to declare a value of type `lambda' rather than an attribute-set for the option `home-manager.users.serhiy_makarenko.programs.htop'!
The error in your configuration is that htop.nix
now returns a function that takes an attribute set with config
. And programs.htop
must be an attribute set, where it now is assigned a function.
The quick way to solve this in the pasted configuration is to manually pass config
to the imported htop.nix
module. Something like:
./dotfiles/default.nix
:
{ config, ... }:
{
programs = {
# ..
htop = import ./htop.nix { inherit config; };
};
}
You could also consider importing your modules in ./dotfiles/default.nix
through imports
and let nix pass the attributes. Something like:
./dotfiles/default.nix
:
{ config, ... }:
{
imports = [
./fish.nix
./git.nix
./htop.nix
./ssh.nix
];
}
And change the modules to set the respective options:
./dotfiles/htop.nix
:
{ config, ... }:
programs.htop = {
enable = true;
settings = {
# ..
};
};
Hope this helps!
Thank you, @bjpbakker for the advice. The first approach works well, thank you for pushing me in the right direction. I did not try to implement the second approach yet. How do you think, maybe it is worth adding your explanation to the documentation to make it clear that fields
, leftMeters
, and rightMeters
are required to supply attribute set to be able to generate htop config?
I believe the current documentation identifies the leftMeter
and rightMeter
function as mentioned.
I will close this issue since it is resolved. Feel free to reopen.
Is there an existing issue for this?
Issue description
My configuration is the following.
Content of the
darwin-configuration.nix
:Content of the
./dotfiles/default.nix
:Content of the
./htop.nix
, taken from the home-manager documentation:When I'm trying to run
darwin-rebuild switch
I get the following error:Unfortunatley, closed bugs here related to the htop and changes made for settings declaration do not shed the light to the root cause of the issue. Please, advise.
Thank you.
Maintainer CC
@bjpbakker
System information