Specialisation: Difference between revisions
imported>Pogobanane init |
imported>Rapenne-s add the non-specialized case |
||
Line 39: | Line 39: | ||
{{Note|At times, you may want to overwrite values in specialisations which you have already defined in your parent configuration. To solve this problem in <code>chani</code> example, the parent configuration could define <code>services.xserver.desktopManager.plasma5.enable = false;</code> in an overwritable manner using <code>mkDefault</code> and similar [3]: <code>services.xserver.desktopManager.plasma5.enable = mkDefault false;</code>}} | {{Note|At times, you may want to overwrite values in specialisations which you have already defined in your parent configuration. To solve this problem in <code>chani</code> example, the parent configuration could define <code>services.xserver.desktopManager.plasma5.enable = false;</code> in an overwritable manner using <code>mkDefault</code> and similar [3]: <code>services.xserver.desktopManager.plasma5.enable = mkDefault false;</code>}} | ||
== Special case: the default non-specialised entry == | |||
Specialisations are receiving options in addition to your default configuration, but what if you want to have options in your default configuration that shouldn't be pulled by the specialisations? | |||
There is a specific syntax to declare options that apply to the case environment "not specialised" and that won't be pulled by other specialisations. You need to wrap the options into a new file that is imported into your configuration.nix file | |||
<syntaxHighlight lang=nix> | |||
({ lib, config, pkgs, ... }: { | |||
config = lib.mkIf (config.specialisation != {}) { | |||
# Config that should only apply to the default system, not the specialised ones | |||
# example | |||
hardware.opengl.extraPackages = with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]; | |||
}; | |||
}) | |||
</syntaxHighlight> | |||
== Boot entries == | == Boot entries == |