Add wine support

This commit is contained in:
Victor Mignot 2024-08-02 23:44:40 +02:00
parent 533f1494a5
commit ab9bae3a10
Signed by: dala
GPG key ID: 5E7F2CE1BEAFED3D
5 changed files with 30 additions and 2 deletions

View file

@ -87,6 +87,7 @@
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
my.development.embedded-tools.enable = true; my.development.embedded-tools.enable = true;
my.games.wine.enable = true;
}; };
}; };
}; };

View file

@ -7,7 +7,14 @@
}: }:
let let
gpu = config.my.hardware.gpu; gpu = config.my.hardware.gpu;
hwAccelerationOptionPath = if (machineProps == "unstable") then "graphics" else "opengl"; hwAccelerationOptionPath = if (machineProps.nixpkgs == "unstable") then "graphics" else "opengl";
enable32BitOptionName =
if (machineProps.nixpkgs == "unstable") then "enable32Bit" else "driSupport32Bit";
anyWineUser =
if machineProps.enableHomeManager then
(builtins.any (user: user.my.games.wine.enable) (builtins.attrValues config.home-manager.users))
else
false;
in in
with lib; with lib;
{ {
@ -32,10 +39,14 @@ with lib;
# Small hack as this option path changes between 24.05 and unstable # Small hack as this option path changes between 24.05 and unstable
hardware.${hwAccelerationOptionPath} = { hardware.${hwAccelerationOptionPath} = {
enable = gpu != null; enable = gpu != null;
"${enable32BitOptionName}" = anyWineUser;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
(mkIf (gpu == "intel") intel-media-driver) (mkIf (gpu == "intel") intel-media-driver)
(mkIf (gpu == "intel") intel-compute-runtime) (mkIf (gpu == "intel") intel-compute-runtime)
]; ];
}; };
}; };
} }

View file

@ -28,6 +28,7 @@ in
./communication.nix ./communication.nix
./mail.nix ./mail.nix
./helix.nix ./helix.nix
./games.nix
]; ];
config = { config = {

View file

@ -302,7 +302,7 @@ in
default_border pixel default_border pixel
''; '';
xwayland = false; xwayland = true;
extraSessionCommands = '' extraSessionCommands = ''
${wlrRendererLine} ${wlrRendererLine}

View file

@ -0,0 +1,15 @@
{
pkgs,
lib,
config,
...
}:
with lib;
{
options.my.games.wine.enable = mkOption {
type = types.bool;
default = false;
};
config = mkIf config.my.games.wine.enable { home.packages = with pkgs; [ wine ]; };
}