Open yswtrue opened 1 year ago
That would be great !
I continued the work on this from a closed PR in my fork. I did reach out to CodeWeavers on the BetterTesters forum, but didn't receive a response. I need to prod, because I can't perform my usual tests for CodeWeavers of CrossOver as it doesn't run well on NixOS.
I continued the work on this from a closed PR in my fork. I did reach out to CodeWeavers on the BetterTesters forum, but didn't receive a response. I need to prod, because I can't perform my usual tests for CodeWeavers of CrossOver as it doesn't run well on NixOS.
What are the limitations you are facing currently?
@zink-chimaera Limitations in which sense?
The derivation currently doesn't build correctly, I'm awaiting to hear back from CodeWeavers currently.
I can build and run the crossover, but I don't know how to add 32bit libs
@yswtrue Ah. I haven't yet gotten my derivation to build, and I wasn't going to make it into a PR until it did. Would you like to collaborate?
I was also going to add support for Darwin, too - but I think that'll be a separate PR.
This is the derivation, I think maybe I need to add the 32-bit library manually, lib.makeLibraryPath
seems only get the 64-bit path.
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, pkgs
, steam-run
, wrapGAppsHook
, gobject-introspection
, glibc_multi
, pkgsi686Linux
}:
let
libraries = with pkgs; [
gst_all_1.gstreamer
alsa-lib
glibc
freetype
libpng
zlib
lcms
libGL
glui
libpcap
openssl
gtkdialog
gtk3
perl
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXcursor
xorg.libXrandr
gdk-pixbuf-xlib
cups
dbus
pkgsi686Linux.gst_all_1.gstreamer
pkgsi686Linux.openssl
pkgsi686Linux.alsa-lib
pkgsi686Linux.glibc
pkgsi686Linux.glib
pkgsi686Linux.freetype
pkgsi686Linux.libpng
pkgsi686Linux.zlib
pkgsi686Linux.lcms
pkgsi686Linux.libGL
pkgsi686Linux.glui
pkgsi686Linux.libxml2
pkgsi686Linux.mpg123
(python3.withPackages (p: with p; [
pygobject3 gst-python dbus-python pycairo
]))
pango
glib
vte
desktop-file-utils
sane-backends
ocl-icd
libunwind
libxcrypt-legacy
libgphoto2
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
openal
apulse
fontconfig
gnutls
gsm
libexif
openldap
pulseaudio
xorg.libXcomposite
xorg.libXinerama
libxml2
libxslt
xorg.libXxf86vm
xorg.libXxf86dga
mpg123
nss_latest
sane-frontends
sane-backends
v4l-utils
] ;
version = "22.1.1-1";
in
stdenv.mkDerivation rec {
pname = "crossover";
inherit version;
src = fetchurl {
url = "https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_${version}.deb";
sha256 = "sha256-0HRqCVJcqgbp3gXkuAEwl7EKS8lGv2+Gc5FhixRARxs=";
};
nativeBuildInputs = [
glibc_multi
autoPatchelfHook
wrapGAppsHook
gobject-introspection
makeWrapper
dpkg
];
autoPatchelfIgnoreMissingDeps = [
"libpcap.so.0.8"
"libcapi20.so.3"
];
buildInputs = libraries;
unpackCmd = "dpkg -x $src source";
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
installPhase = ''
mkdir -p $out/opt
mv opt/* $out/opt/
mv usr $out/usr
makeWrapper $out/opt/cxoffice/bin/crossover $out/bin/crossover \
--prefix PATH : "${lib.makeBinPath libraries}" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libraries}" \
--prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${pname}" \
--prefix XDG_DATA_DIRS : "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}" \
--prefix XDG_DATA_DIRS : "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"
runHook preFixup
runHook postInstall
'';
meta = with lib; {
description = "Run your Windows® app on MacOS, Linux, or ChromeOS";
maintainers = with maintainers; [ yswtrue ];
license = licenses.gpl3Only;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
platforms = [ "x86_64-linux" ];
};
}
This one can use normally now, but I can't register software license, because steam-run can't use sudo
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, pkgs
, steam
, wrapGAppsHook
, gobject-introspection
, glibc_multi
, gsettings-desktop-schemas
}:
let
gds = gsettings-desktop-schemas;
steam-run = (steam.override {
extraPkgs = p: with p; [
];
extraLibraries = p: with p; [
gnutls
openldap
gmp
openssl
gst_all_1.gstreamer
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libunwind
sane-backends
libgphoto2
openal
apulse
libpcap
sane-backends
ocl-icd
libxcrypt-legacy
];
}).run;
version = "22.1.1-1";
in
stdenv.mkDerivation rec {
pname = "crossover";
inherit version;
buildInputs = [
steam-run
pkgs.gtkdialog
pkgs.gtk3
pkgs.vte
(pkgs.python3.withPackages (p: with p; [
pygobject3
gst-python
dbus-python
pycairo
]))
];
src = fetchurl {
url = "https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_${version}.deb";
sha256 = "sha256-0HRqCVJcqgbp3gXkuAEwl7EKS8lGv2+Gc5FhixRARxs=";
};
nativeBuildInputs = [
glibc_multi
# autoPatchelfHook
wrapGAppsHook
gobject-introspection
makeWrapper
dpkg
];
autoPatchelfIgnoreMissingDeps = [
"libpcap.so.0.8"
"libcapi20.so.3"
];
unpackCmd = "dpkg -x $src source";
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
installPhase = ''
mkdir -p $out/opt
mv opt/* $out/opt/
mv usr $out/usr
makeWrapper ${steam-run}/bin/steam-run $out/bin/crossover \
--add-flags $out/opt/cxoffice/bin/crossover \
--set-default GSETTINGS_SCHEMA_DIR "${gds}/share/gsettings-schemas/${gds.pname}-${gds.version}/glib-2.0/schemas"
runHook preFixup
runHook postInstall
'';
meta = with lib; {
description = "Run your Windows® app on MacOS, Linux, or ChromeOS";
maintainers = with maintainers; [ yswtrue ];
license = licenses.gpl3Only;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
platforms = [ "x86_64-linux" ];
};
}
I think it might be best to collaborate on a PR. I don't think this issue was intended for code-pasting.
Looking at your derivation, it seems fairly 'hacky' - with no offence meant, of course. I wouldn't be using steam-run
for this.
Or perhaps we could collaborate on a Discourse post?
+1
+1
I have contacted CodeWeavers and reached somebody, but they weren't sure what they need todo from their end. I asked again, this time with the issue that we cannot register the software because steam-run cannot run as sudo...
Other than that, the procedure to create the package from the derivation can be done for testing as follows:
mkdir crossover
cd crossover
nano default.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.callPackage ./crossover.nix {}
nano crossover.nix
add the content of https://github.com/NixOS/nixpkgs/issues/209545#issuecomment-1650166979
export NIXPKGS_ALLOW_UNFREE=1
nix-build
Got reply from support. Amazing people.
---snip--- Yes, you can manually download your license files from our website here https://www.codeweavers.com/account/edit?inp=lic and unzip that and place the 2 files in either /opt/cxoffice/etc or ~/cxoffice/etc depending on how Crossover was installed. I assume the directory structure is a bit different on NixOS but hopefully that points you in the right direction. ---snip---
@zDEFz 's procedure as a shellscript at the bottom :wink:
License didn't work though... when I try to open the About
screen, crossover fails to find <nixstore-package-dir>/opt/cxoffice/license.txt
(license.txt
is inside the generated license zip file) and - neither of those locations is writable<nixstore-package-dir>/opt/cxoffice/doc/license.txt.gz
Traceback (most recent call last):
File "/nix/store/jqg51ln7y8bdsdaan43nv1s4zhwrywrv-crossover-22.1.1-1/opt/cxoffice/lib/python/crossoverui.py", line 1111, in on_about_activate
with open(os.path.join(cxutils.CX_ROOT, 'license.txt'), 'r', encoding='utf8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/jqg51ln7y8bdsdaan43nv1s4zhwrywrv-crossover-22.1.1-1/opt/cxoffice/license.txt'
Seems like crossover.nix
will need to symlink /opt/cxoffice/etc
to ~/.cxoffice
(created by crossover) or something else writable and we put the license in there.
~/build-crossover.sh
#!/usr/bin/env bash
mkdir ~/crossover
cd ~/crossover || exit
cat <<EOF > default.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.callPackage ./crossover.nix {}
EOF
# copied from https://github.com/NixOS/nixpkgs/issues/209545#issuecomment-1650166979
# then escaped to stop bad substitution -> all $ replaced with \$
cat <<EOF > crossover.nix
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, pkgs
, steam
, wrapGAppsHook
, gobject-introspection
, glibc_multi
, gsettings-desktop-schemas
}:
let
gds = gsettings-desktop-schemas;
steam-run = (steam.override {
extraPkgs = p: with p; [
];
extraLibraries = p: with p; [
gnutls
openldap
gmp
openssl
gst_all_1.gstreamer
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libunwind
sane-backends
libgphoto2
openal
apulse
libpcap
sane-backends
ocl-icd
libxcrypt-legacy
];
}).run;
version = "22.1.1-1";
in
stdenv.mkDerivation rec {
pname = "crossover";
inherit version;
buildInputs = [
steam-run
pkgs.gtkdialog
pkgs.gtk3
pkgs.vte
(pkgs.python3.withPackages (p: with p; [
pygobject3
gst-python
dbus-python
pycairo
]))
];
src = fetchurl {
url = "https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_\${version}.deb";
sha256 = "sha256-0HRqCVJcqgbp3gXkuAEwl7EKS8lGv2+Gc5FhixRARxs=";
};
nativeBuildInputs = [
glibc_multi
# autoPatchelfHook
wrapGAppsHook
gobject-introspection
makeWrapper
dpkg
];
autoPatchelfIgnoreMissingDeps = [
"libpcap.so.0.8"
"libcapi20.so.3"
];
unpackCmd = "dpkg -x \$src source";
preFixup = ''
makeWrapperArgs+=("''\${gappsWrapperArgs[@]}")
'';
installPhase = ''
mkdir -p \$out/opt
mv opt/* \$out/opt/
mv usr \$out/usr
makeWrapper \${steam-run}/bin/steam-run \$out/bin/crossover \
--add-flags \$out/opt/cxoffice/bin/crossover \
--set-default GSETTINGS_SCHEMA_DIR "\${gds}/share/gsettings-schemas/\${gds.pname}-\${gds.version}/glib-2.0/schemas"
runHook preFixup
runHook postInstall
'';
meta = with lib; {
description = "Run your Windows® app on MacOS, Linux, or ChromeOS";
maintainers = with maintainers; [ yswtrue ];
license = licenses.gpl3Only;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
platforms = [ "x86_64-linux" ];
};
}
EOF
export NIXPKGS_ALLOW_UNFREE=1
nix-build
./result/bin/crossover # Run it
I had a go at trying to get the package to find <nix-dir>/opt/cxoffice/license.txt
at /etc/cxoffice/license.txt
and while it looks good running ls -l result/opt/cxoffice
and running cat result/opt/cxoffice/license.txt
,
~/crossover/result/opt/cxoffice/lib/python/crossoverui.py:1111 still fails to find the license.txt file...
Here is the updated script including the postInstall step that makes the link to /etc/cxoffice
:
#!/usr/bin/env bash
if [ ! -e /etc/cxoffice/license.txt ]; then
sudo unzip -d /etc/cxoffice ~/Downloads/crossover-linux-license.zip || exit
fi
mkdir ~/crossover
cd ~/crossover || exit
cat <<EOF > default.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.callPackage ./crossover.nix {}
EOF
# copied from https://github.com/NixOS/nixpkgs/issues/209545#issuecomment-1650166979, then all $ replaced with \$
cat <<EOF > crossover.nix
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, pkgs
, steam
, wrapGAppsHook
, gobject-introspection
, glibc_multi
, gsettings-desktop-schemas
}:
let
gds = gsettings-desktop-schemas;
steam-run = (steam.override {
extraPkgs = p: with p; [
];
extraLibraries = p: with p; [
gnutls
openldap
gmp
openssl
gst_all_1.gstreamer
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libunwind
sane-backends
libgphoto2
openal
apulse
libpcap
sane-backends
ocl-icd
libxcrypt-legacy
];
}).run;
version = "22.1.1-1";
in
stdenv.mkDerivation rec {
pname = "crossover";
inherit version;
buildInputs = [
steam-run
pkgs.gtkdialog
pkgs.gtk3
pkgs.vte
(pkgs.python3.withPackages (p: with p; [
pygobject3
gst-python
dbus-python
pycairo
]))
];
src = fetchurl {
url = "https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_\${version}.deb";
sha256 = "sha256-0HRqCVJcqgbp3gXkuAEwl7EKS8lGv2+Gc5FhixRARxs=";
};
nativeBuildInputs = [
glibc_multi
# autoPatchelfHook
wrapGAppsHook
gobject-introspection
makeWrapper
dpkg
];
autoPatchelfIgnoreMissingDeps = [
"libpcap.so.0.8"
"libcapi20.so.3"
];
unpackCmd = "dpkg -x \$src source";
preFixup = ''
makeWrapperArgs+=("''\${gappsWrapperArgs[@]}")
'';
installPhase = ''
mkdir -p \$out/opt
mv opt/* \$out/opt/
mv usr \$out/usr
makeWrapper \${steam-run}/bin/steam-run \$out/bin/crossover \
--add-flags \$out/opt/cxoffice/bin/crossover \
--set-default GSETTINGS_SCHEMA_DIR "\${gds}/share/gsettings-schemas/\${gds.pname}-\${gds.version}/glib-2.0/schemas"
runHook preFixup
runHook postInstall
'';
# Added post Install to replace out/opt/cxoffice with a symlink to /etc/cxoffice on the host
postInstall = ''
rmdir \$out/opt/cxoffice/etc
ln -s /etc/cxoffice/license.txt \$out/opt/cxoffice
ln -s /etc/cxoffice \$out/opt/cxoffice/etc
'';
meta = with lib; {
description = "Run your Windows® app on MacOS, Linux, or ChromeOS";
maintainers = with maintainers; [ yswtrue ];
license = licenses.gpl3Only;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
platforms = [ "x86_64-linux" ];
};
}
EOF
NIXPKGS_ALLOW_UNFREE=1 nix-build
./result/bin/crossover # Run it
Once we get past the license issue, we still have a number of libraries that Crossover reports as missing in Help
->System Information
that may break certain things:
I think that the libraries issues can be solved the same way it's done for Lutris.
Agreed. I am in contact with CodeWeavers, and they have said they're looking at Flatpak support, as well as removing 32-bit libs - but this is long-term.
Agreed. I am in contact with CodeWeavers, and they have said they're looking at Flatpak support, as well as removing 32-bit libs - but this is long-term.
any new information regarding the flatpak or at least nix support?
Agreed. I am in contact with CodeWeavers, and they have said they're looking at Flatpak support, as well as removing 32-bit libs - but this is long-term.
any new information regarding the flatpak or at least nix support?
No ref Flatpak. They're looking into Flatpak support. But Nix support is up to the community, and I think it'd be best to simplify the derivation by waiting for CW to remove the 32-bit deps.
Plus one for this!
No updates yet. I'm going to reach out to CodeWeavers this weekend.
Please, show your support by reacting with :+1:
on the top-level post. Otherwise we all get pinged.
Any news about this add ?
Gonna quote what I said, above your comment:
No updates yet. I'm going to reach out to CodeWeavers this weekend. Please, show your support by reacting with :+1: on the top-level post. Otherwise we all get pinged.
The last sentence being key. I'm waiting to hear back from Codeweavers, but until then, it's not my place to disclose.
What do you think about something like :
# Copy license.zip
mkdir -p $out/opt/cxoffice/etc/
cp ${pkgs.copyFile { src = ~/license.zip; }} $out/opt/cxoffice/etc/license.zip
# Extract license.zip
if [ ! -e /opt/cxoffice/etc/license.txt ]; then
echo "Extracting license..."
unzip -d /opt/cxoffice/etc/ $out/opt/cxoffice/etc/license.zip || exit
fi
Also have do this :
#!/usr/bin/env bash
mkdir -p ~/crossover
cd ~/crossover || exit
cat <<EOF > default.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.callPackage ./crossover.nix {}
EOF
cat <<EOF > crossover.nix
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, pkgs
, steam
, wrapGAppsHook
, gobject-introspection
, glibc_multi
, gsettings-desktop-schemas
}:
let
gds = gsettings-desktop-schemas;
steam-run = (steam.override {
extraPkgs = p: with p; [
];
extraLibraries = p: with p; [
gnutls
openldap
gmp
openssl
gst_all_1.gstreamer
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libunwind
sane-backends
libgphoto2
openal
apulse
libpcap
sane-backends
ocl-icd
libxcrypt-legacy
];
}).run;
version = "22.0.1-1";
in
stdenv.mkDerivation rec {
pname = "crossover";
inherit version;
buildInputs = [
steam-run
pkgs.gtkdialog
pkgs.gtk3
pkgs.vte
(pkgs.python3.withPackages (p: with p; [
pygobject3
gst-python
dbus-python
pycairo
]))
];
src = fetchurl {
url = "https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_\${version}.deb";
sha256 = "sha256-0wpM/4LCfjeZLgt0ECGdRuL3YPE0gQ/2otzUkJ9B/dY=";
};
nativeBuildInputs = [
glibc_multi
wrapGAppsHook
gobject-introspection
makeWrapper
dpkg
pkgs.unzip
];
autoPatchelfIgnoreMissingDeps = [
"libpcap.so.0.8"
"libcapi20.so.3"
];
unpackCmd = "dpkg -x \$src source";
preFixup = ''
makeWrapperArgs+=("''\${gappsWrapperArgs[@]}")
'';
installPhase = ''
mkdir -p \$out/opt
mv opt/* \$out/opt/
mv usr \$out/usr
makeWrapper \${steam-run}/bin/steam-run \$out/bin/crossover \
--add-flags \$out/opt/cxoffice/bin/crossover \
--set-default GSETTINGS_SCHEMA_DIR "\${gds}/share/gsettings-schemas/\${gds.pname}-\${gds.version}/glib-2.0/schemas"
runHook preFixup
runHook postInstall
'';
meta = with lib; {
description = "Run your Windows® app on MacOS, Linux, or ChromeOS";
maintainers = with maintainers; [ yswtrue ];
license = licenses.gpl3Only;
platforms = [ "x86_64-linux" ];
};
}
EOF
if [ -z "${NIXPKGS_ALLOW_UNFREE+x}" ]; then
export NIXPKGS_ALLOW_UNFREE=1
echo "NIXPKGS_ALLOW_UNFREE was not set, now it's set to 1"
else
echo "NIXPKGS_ALLOW_UNFREE is already set to $NIXPKGS_ALLOW_UNFREE"
fi
if [ -d ./result ]; then
./result/bin/crossover
else
nix-build || exit
./result/bin/crossover
fi
That looks not so clearly split. Why have you put the derivation in a heredoc?
So, I wouldn't rely on steam-run
, personally.
With regards to the license, I think we should avoid storing the license in the Nix store. It would also present problems with Hydra - I think.
Let me get back to Codeweavers, and ask how they would proceed with license storage, and the lib32
licenses. A major blocker is that Crossover, oob, uses the host system's package manager to install dependencies. Nix being Nix, we can't work that way.
Project description
CrossOver. Keep your favorite Windows Apps running in MacOS, Linux, Chrome & Android tablets. Try Now Buy Now · Check App Compatibility.
Metadata