I am curious about existing approaches to packaging applications that run via Wine within Nix derivations. I have come across the desire to do so a few times over the past couple of years, but never had the time to work out how to achieve this nicely.
While there are quite a few posts discussing specific Wine packages, I thought it might be worth opening a dedicated post where Nix users can share solutions they’ve used, discuss the challenges, and possibly come up with some ideas for a general solution or expression that we could eventually land in nixpkgs itself.
As far as I’m aware there isn’t yet a “standard” or go-to solution for packaging Wine applications - please correct me if I’m wrong!
From what I’ve read there are some challenges in handling the amount of mutability required by some applications, though I’m sure there is probably a function or two that could at least ease the general process.
All that said, I think even just consolidating some examples in one place would be really useful.
Here are some related links I’ve discovered so far:
- https://github.com/NixOS/nixpkgs/issues/10165 - At first I thought this would be about configuring the Wine package itself, but this Github issue explores exactly this topic and already has some interesting links and suggestions.
- https://github.com/NixOS/nixpkgs/pull/10006 - An attempt to add some windows audio packages… Though ultimately discluded for their proprietariness, may contain an interesting approach.
https://github.com/NixOS/nixpkgs/pull/7597 - Discluded for similar reasons, but uses
writeScriptto create a derivation that wraps the program with some prior Wine setup checks and configuration that might be interesting.
https://github.com/lucasew/nixcfg/blob/e542e743774f499f996a4f886a8d4a4133fce258/packages/wrapWine.nix Shared recently in the previously mentioned issue, this
wrapWinemodule seems like a generalised approach, though I’m yet to dig into the rest of the repo to see how it’s used in their packages.
While I imagine it might not be common to include Wine applications in nixpkgs itself (particularly as they often require having an existing executable, are unfree, or break between different versions of Wine which might be a bit much to ask of maintainers), I can imagine a general
wrapWine function or something along those lines would still be a great help for declarative packaging downstream, whether for personal tools, video game archival, that one Windows-only program your job requires, etc.