1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

nixos/steam: always apply extraLibraries and make them additive

Before, setting {option}`programs.steam.package` would result in a steam without
the {option}`hardware.opengl.package`, {option}`hardware.opengl.extraPackages`
etc. You had to manually add them yourself.

Additionally, overlaying `steam = prev.steam.override { extraLibraries = [ ... ]; }`
resulted in those extra libraries not actually being put into the fhsenv because
they'd be fully overridden by the option's default.

Now, the user can supply a custom steam to {option}`programs.steam.package` with
its own list of extraLibraries which will not be overridden and overlays work as
expected too.
This commit is contained in:
Atemu 2023-03-07 20:24:28 +01:00
parent 192c3ecd4b
commit 4731598712

View file

@ -9,23 +9,31 @@ in {
enable = mkEnableOption (lib.mdDoc "steam");
package = mkOption {
type = types.package;
default = pkgs.steam.override {
extraLibraries = pkgs: with config.hardware.opengl;
if pkgs.stdenv.hostPlatform.is64bit
then [ package ] ++ extraPackages
else [ package32 ] ++ extraPackages32;
};
defaultText = literalExpression ''
pkgs.steam.override {
extraLibraries = pkgs: with config.hardware.opengl;
type = types.package;
default = pkgs.steam;
defaultText = literalExpression "pkgs.steam";
example = literalExpression ''
pkgs.steam-small.override {
extraLibraries = with pkgs; [
atk
];
}
'';
apply = steam: steam.override (prev: {
extraLibraries = pkgs: let
prevLibs = if prev ? extraLibraries then prev.extraLibraries pkgs else [ ];
additionalLibs = with config.hardware.opengl;
if pkgs.stdenv.hostPlatform.is64bit
then [ package ] ++ extraPackages
else [ package32 ] ++ extraPackages32;
}
'';
in prevLibs ++ additionalLibs;
});
description = lib.mdDoc ''
steam package to use.
The Steam package to use. Additional libraries are added from the system
configuration to ensure graphics work properly.
Use this option to customise the Steam package rather than adding your
custom Steam to {option}`environment.systemPackages` yourself.
'';
};