What is going on with mkIf here?

I have a mkIf to enable / disable some configuration in home-manager.

{ options, config, systemConfig, inputs, lib, pkgs, ... }:

with lib;
let
  cfg = systemConfig.my_modules.desktopEnvironment;
  condition = (cfg == "hyprland");

in
{

  config = mkIf condition {

    services.udiskie = trace "Hyprland home module loaded: ${boolToString condition}" {
      enable = true;
    };
  };
}

I cannot understand how this can trace out

trace: Hyprland home module loaded: false

when the module is loaded. In my mind, the code within the attrset after the mkIf should not get evaluated if the condition was false.

Since mkIf is not actually implemented using if, this behavior is justified.

These should help you:

I think I understand now, but it took a while :slight_smile: . But does that mean that if I lock some configuration behind a mkIf, the entire configuration in the mkIf will still be evaluated even if it never ends up being used? So it could be considered that there is some amount of unnecessary compute going on?