mirror of
https://github.com/pabloaul/lsfg-vk-flake.git
synced 2025-08-27 10:56:29 -03:00
module.nix: Don't warn when declaring option
The option is _always_ evaluated and therefore the warning is always output, even if your configuration is unaffected. This refactors the module to: - Only create env vars if their config is actually declared - Stick the warning in the config declaration instead of the option
This commit is contained in:
parent
ec1b66adcb
commit
c88ac624f0
1 changed files with 19 additions and 13 deletions
32
module.nix
32
module.nix
|
@ -19,9 +19,7 @@ in
|
|||
default = lsfg-vk;
|
||||
};
|
||||
|
||||
losslessDLLFile =
|
||||
lib.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set."
|
||||
lib.mkOption
|
||||
losslessDLLFile = lib.mkOption
|
||||
{
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
|
@ -45,15 +43,23 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
# Installs the Vulkan implicit layer system-wide
|
||||
environment.etc."vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json".source =
|
||||
"${cfg.package}/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json";
|
||||
|
||||
environment.sessionVariables.LSFG_DLL_PATH = lib.mkIf (cfg.losslessDLLFile != null) cfg.losslessDLLFile;
|
||||
|
||||
environment.sessionVariables.LSFG_CONFIG = lib.mkIf (cfg.configFile != null) cfg.configFile;
|
||||
};
|
||||
# Installs the Vulkan implicit layer system-wide
|
||||
environment.etc."vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json".source =
|
||||
"${cfg.package}/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json";
|
||||
}
|
||||
(lib.mkIf (cfg.losslessDLLFile != null) {
|
||||
environment.sessionVariables.LSFG_DLL_PATH =
|
||||
lib.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set."
|
||||
cfg.losslessDLLFile;
|
||||
})
|
||||
(lib.mkIf (cfg.configFile != null) {
|
||||
environment.sessionVariables.LSFG_CONFIG = cfg.configFile;
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue