I am trying to set configuration based on hostname
config = lib.mkMerge [
( lib.mkIf config.networking.hostName == "nuc" {
config.installconfig.hardware.intel = true;
} )
( lib.mkIf config.networking.hostName == "xps" {
config.installconfig = {
hardware.intel = true;
workstation-components.enable = true;
users.allow-rad = true;
};
} )
];
I get the following error at "nuc"
error: attempt to call something which is not a function but a string.
I understand the error, but I am not sure how to structure the lib.mkIf condition block.
Could someone help me fix this please?
You need to group together the parts of the conditionals:
let
config = pkgs.lib.mkMerge [
(pkgs.lib.mkIf (config.networking.hostName == "nuc") {
config.installconfig.hardware.intel = true;
})
(pkgs.lib.mkIf (config.networking.hostName == "xps") {
config.installconfig = {
hardware.intel = true;
workstation-components.enable = true;
users.allow-rad = true;
};
})
];
in
config.contents