Re: [Nix-dev] packaging windows applications through wine

2017-04-26 Thread Alexander V. Nikolaev
On Tue, Apr 25, 2017 at 02:01:11AM +0200, aszlig wrote:

> I guess the simplest method would be the latter, because if you extract
> the installer archive there might be some missing files or registry keys
> that you need to apply as well.
> 
> Here is an example for automating this via xdotool:
> 
> https://github.com/openlab-aux/vuizvui/blob/97e440e996e9c418e46af3dbcdba58595b5c11ea/pkgs/aszlig/santander/default.nix#L63-L74
> 

Looks interesting. Thank you for link.

> > The other challenge I see is where do you put the wineprefix? Because
> > on the one hand you want the installation to happen at system build
> > time, so that would suggest the nix store. But you also want the
> > application to be able to write files (like saves ) so that would
> > have to be in your home folder.
> 
> You could set the user data directory to some other unix path via
> dosdevices/ and change %APPDATA% accordingly, like:
> 
> https://support.microsoft.com/en-us/help/190234/prb-how-to-modify-the-personal-directory-for-all-new-users
> 
> Another way would be to use a wrapper that uses overlayfs to write all
> the differences of the immutable store path to some location within the
> home directory (like eg. ${XDG_DATA_HOME:-$HOME/.local/share}/your_app).
> 

Combination of bindfs+unionfs works well.
(bindfs for mangle permissions from 0444 to 0644, otherwise unionfs show
files from store as read-only. I picked unionfs as more bullet-proof,
don't know how kernel' overlayfs behave here)
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] packaging windows applications through wine

2017-04-25 Thread Badi' Abdul-Wahid
My (quasi-nixified) approach is separate the installation from launching
the app. Installation is run via a manually invoked install.sh while
launching is packaged with a nix derivation that I install.

My install.sh looks something like this:

ME="$(cd $(dirname $0) && pwd -P)"
APP=foobarbaz
INSTALLER=install.exe
export WINEPREFIX=$HOME/wineprefix/$APP
cd "$ME"
wine "$INSTALLER"

(I don't have access to my home computer right now so the above is from
memory).

I then define in my config.nix something like:


  run-in-wine =
{ name
, cpath
, exe
, prefix
, stdenv, bash, wineFull, ...
}:
stdenv.mkDerivation {
  name = "run-${name}";
  src = builtins.toFile "run-${name}.sh" ''
#!/usr/bin/env bash
cd "${prefix}/drive_c/${cpath}"
exec wine "${exe}"
  '';
  phases = [ "installPhase" ];
  installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/run-${name}
chmod +x $out/bin/run-${name}
  '';
  buildInputs = [];
  propagatedBuildInputs = [ wineFull ];
};


  run-foobarbaz = callPackage run-in-wine {
prefix = "~/wineprefix";
name = "foobarbaz";
cpath = "relative/to/${prefix}/drive_c";
exe = "run_foobarbaz.exe";
  };


With the run-foobarbaz derivation installed I can invoke run-foobarbaz from
rofi, dmenu, or the CLI.


Incidentally, I've found that I need to use "nouveau" instead of "nvidia"
for services.xserver.videoDrivers for my nvidia graphics card else the
(successfully installed) app would not launch. There may be another fix,
but I stopped digging once I switched to nouveau.



On Mon, Apr 24, 2017 at 8:01 PM, aszlig  wrote:

> On Mon, Apr 24, 2017 at 02:39:02AM +, Taeer Bar-Yam wrote:
> > When one installs things through wine, one usually has to click
> > through a bunch of agreements for things installed via winetricks. Can
> > we bypass this so we can make nix packages for these things that
> > installs nicely?
>
> That really depnds on the installer:
>
>   * If it's an MSI file, you may be able to automate this using msiexec.
>   * Some installers can be extracted via cabextract, unshield, 7zip, etc...
>   * You could override specific functionality via WINEDLLOVERRIDES, but
> that might be a bit difficult in a GUI application.
>   * Automate it via something like xdotool in an Xvfb.
>
> I guess the simplest method would be the latter, because if you extract
> the installer archive there might be some missing files or registry keys
> that you need to apply as well.
>
> Here is an example for automating this via xdotool:
>
> https://github.com/openlab-aux/vuizvui/blob/97e440e996e9c418
> e46af3dbcdba58595b5c11ea/pkgs/aszlig/santander/default.nix#L63-L74
>
> In this case the installer is quite simple because all you need to do is
> click "Next -> Next -> Next -> ..." here.
>
> If it's something more complicated, like if you need ta accept an EULA,
> then you might be either in luck and you just need to apply something
> like "key alt+a Return" all over again if for example alt+a is for
> "accept EULA".
>
> In most cases however it isn't that easy, so I'd try to look whether you
> can get information about what's displayed via tracing the font
> rendering calls in wine. Another way would be to use OCR, but that is
> slower and might be a bit error prone.
>
> > The other challenge I see is where do you put the wineprefix? Because
> > on the one hand you want the installation to happen at system build
> > time, so that would suggest the nix store. But you also want the
> > application to be able to write files (like saves ) so that would
> > have to be in your home folder.
>
> You could set the user data directory to some other unix path via
> dosdevices/ and change %APPDATA% accordingly, like:
>
> https://support.microsoft.com/en-us/help/190234/prb-how-to-m
> odify-the-personal-directory-for-all-new-users
>
> Another way would be to use a wrapper that uses overlayfs to write all
> the differences of the immutable store path to some location within the
> home directory (like eg. ${XDG_DATA_HOME:-$HOME/.local/share}/your_app).
>
> > Is how to package wine applications a solved problem, or do I need to
> > do some creative work?
>
> The latter :-)
>
> a!
> --
> aszlig
> Universal dilettante
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iF4EAREIAAYFAlj+kccACgkQ0OvQ7IwtyWEIugEAjWghnvvaFOh6MSs3qAK3EOoI
> g8rIjX230t7flmL4ahwA/RBckrZw2L1arsugUpMldg6GJSDlWpMEjAuHTgb0RlX5
> =Hhom
> -END PGP SIGNATURE-
>
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
>
>


-- 

Badi' Abdul-Wahid
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] packaging windows applications through wine

2017-04-24 Thread aszlig
On Mon, Apr 24, 2017 at 02:39:02AM +, Taeer Bar-Yam wrote:
> When one installs things through wine, one usually has to click
> through a bunch of agreements for things installed via winetricks. Can
> we bypass this so we can make nix packages for these things that
> installs nicely?

That really depnds on the installer:

  * If it's an MSI file, you may be able to automate this using msiexec.
  * Some installers can be extracted via cabextract, unshield, 7zip, etc...
  * You could override specific functionality via WINEDLLOVERRIDES, but
that might be a bit difficult in a GUI application.
  * Automate it via something like xdotool in an Xvfb.

I guess the simplest method would be the latter, because if you extract
the installer archive there might be some missing files or registry keys
that you need to apply as well.

Here is an example for automating this via xdotool:

https://github.com/openlab-aux/vuizvui/blob/97e440e996e9c418e46af3dbcdba58595b5c11ea/pkgs/aszlig/santander/default.nix#L63-L74

In this case the installer is quite simple because all you need to do is
click "Next -> Next -> Next -> ..." here.

If it's something more complicated, like if you need ta accept an EULA,
then you might be either in luck and you just need to apply something
like "key alt+a Return" all over again if for example alt+a is for
"accept EULA".

In most cases however it isn't that easy, so I'd try to look whether you
can get information about what's displayed via tracing the font
rendering calls in wine. Another way would be to use OCR, but that is
slower and might be a bit error prone.

> The other challenge I see is where do you put the wineprefix? Because
> on the one hand you want the installation to happen at system build
> time, so that would suggest the nix store. But you also want the
> application to be able to write files (like saves ) so that would
> have to be in your home folder.

You could set the user data directory to some other unix path via
dosdevices/ and change %APPDATA% accordingly, like:

https://support.microsoft.com/en-us/help/190234/prb-how-to-modify-the-personal-directory-for-all-new-users

Another way would be to use a wrapper that uses overlayfs to write all
the differences of the immutable store path to some location within the
home directory (like eg. ${XDG_DATA_HOME:-$HOME/.local/share}/your_app).

> Is how to package wine applications a solved problem, or do I need to
> do some creative work?

The latter :-)

a!
-- 
aszlig
Universal dilettante


signature.asc
Description: Digital signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] packaging windows applications through wine

2017-04-24 Thread Tomas Hlavaty
Hi Taeer,

Taeer Bar-Yam  writes:
> Not sure if you intentionally didn't reply to the group, so I'll send this 
> just to you.

ah, the message was meant for the list.  Thanks for telling me.

>> Hi Taeer,
>> 
>>> When one installs things through wine, one usually has to click
>>> through a bunch of agreements for things installed via winetricks. Can
>>> we bypass this so we can make nix packages for these things that
>>> installs nicely?
>> 
>> It depends.  Is it free software?  Then you can build it from source and
>> don't need any interactive installer.
>  
> LoL isn't free software. But regardless, the process of installing anything in
> wine (even free software) usually requires what I think is proprietary windows
> stuff which requires clicking through installation (like vcrun2005 or
> whatever)

If LoL requires users to click through a bunch of agreements, are you
allowed to bypass that?

>>> The other challenge I see is where do you put the wineprefix? Because
>>> on the one hand you want the installation to happen at system build
>>> time, so that would suggest the nix store. But you also want the
>>> application to be able to write files (like saves ) so that would
>>> have to be in your home folder.
>> 
>> wineprefix should not be in the nix store.
>> 
>> At build-time, wineprefix can be in a temporary directory which is
>> writeable.
>> 
>> At run-time, it is usually in ~/.wine unless you specify something
>> different.
>
> Right, but the problem is if you're installing something via 
> configuration.nix,
> all of the results have to go into the store, because you don't even know what
> users there are.

Yes, results go into the store.  It does not mean that wineprefix has to
point there, e.g.

$ WINEPREFIX=~/.wine64-test wine64 /nix/store/xx-myprog-1.0/bin/myprog.exe

can work.

>>> Is how to package wine applications a solved problem, or do I need to
>>> do some creative work?
>> 
>> It depends.  At work, we cross-compile some packages with mingw and test
>> them under wine.  This works quite well but is far from solved problem
>> as most packages don't work out of the box.  It's still better than
>> chasing prebuilt and up-to-date binaries or installers on the web.
>
> I'm talking specifically about making nix packages for applications run 
> through
> wine. So you can just add e.g. league_of_legends to your systemPackages, and 
> it
> will install it in a wine prefix and provides you an alias so you can just run
> it, and not even know it's running through wine.

There is not much special about nix packages for applications run
through wine.  Just write a package with a shell script which will do
everything necessary without users having to worry about anything.

I don't think "install it in a wine prefix" is correct way to describe
it.

Tomas
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] packaging windows applications through wine

2017-04-23 Thread Taeer Bar-Yam

I'm thinking of making a nix package for League of Legends, and my question is 
this:

When one installs things through wine, one usually has to click through a bunch
of agreements for things installed via winetricks. Can we bypass this so we can
make nix packages for these things that installs nicely? 


The other challenge I see is where do you put the wineprefix? Because on the one
hand you want the installation to happen at system build time, so that would
suggest the nix store. But you also want the application to be able to write
files (like saves ) so that would have to be in your home folder.

Is how to package wine applications a solved problem, or do I need to do some
creative work?

 --Taeer

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev