How to install Steam (x86_64) on a Pinephone (aarch64)?

Of couse it will not run, but maybe it will soon with box86 (progress Steam · Issue #18 · ptitSeb/box86-compatibility-list · GitHub)!

I naively tried it the usual way to see what happens:

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "steam"
    "steam-original"
    "steam-runtime"
  ];

  programs.steam.enable = true;

error:
Failed assertions:
- Option driSupport32Bit only makes sense on a 64-bit system.
- Option driSupport32Bit requires a kernel that supports 32bit emulation

Not sure if the error messages make sense. It is 64-bit, but not x86.

The hardware.opengl.driSupport32Bit option is currently only supported for the nvidia as well as Mesa .

So i remove that by manually installing the steam package.

  environment.systemPackages = with pkgs; [
    steam
    steam-run
  ];

(still allowing the unfree license)

error: i686 Linux package set can only be used with the x86 family.

For some reason Nix knows that Steam is only for x86, even it’s not in the packages meta.

Maybe it will work with cross-compilation (or substitution from cache):

environment.systemPackages = with pkgs; [
    pkgsCross.gnu64.steamPackages.steam
    pkgsCross.gnu64.steam-run
  ];

error: attribute ‘steamPackages’ missing

   at /nix/store/6n7q7c6kx8zddpjzdc6zf24by7h52q0c-source/pkgs/games/steam/default.nix:32:24:

       31|     selfHostHost = pkgsHostHost.${steamPackagesAttr};
       32|     selfTargetTarget = pkgsTargetTarget.${steamPackagesAttr};
         |                        ^
       33|   };

I think i’m very close to the solution, but i don’t know how to solve this error.

You’re probably going to have to re-import nixpkgs, but configured for x86_64. Something like:

  overlays = [(self: super: let
    x86pkgs = import pkgs.path { system = "x86_64-linux"; };
  in {
    inherit (x86pkgs) steam; # plus whatever else you need
  })];
1 Like

That helps. Thanks a lot!

  # use x86_64 steam and allow unfree license
  nixpkgs.overlays = [(self: super: let
    x86pkgs = import pkgs.path { system = "x86_64-linux";
      config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
        "steam"
        "steam-original"
        "steam-runtime"
      ];
    };
  in {
    inherit (x86pkgs) steam steam-run;
  })];

  # allow build for x86_64-linux architecture through emulation
  boot.binfmt.emulatedSystems = [ "x86_64-linux" ];

  environment.systemPackages = with pkgs; [
    steam steam-run
  ];

Local build does not work:

...
building '/nix/store/49pxhxla9a7vzs37qqnmbz51p8p294gz-steam-run.drv'...
building '/nix/store/ys13s6nh0hw1mw3aj3mqb1ljp73wjj8c-steam-wrapper.sh.drv'...
copying path '/nix/store/pdq3hm7syv01csidr28lwhsfqm07nlc6-libusb-1.0.25' from 'https://cache.nixos.org'...
building '/nix/store/s916g54n7dxxq710kbrb4m6p9d67n9wi-builder.pl.drv'...

copying path '/nix/store/qc119mdj6kcrrd18rpbqlcwcb6y17253-libfido2-1.10.0' from 'https://cache.nixos.org'...
ErrorErrorvexecuting '/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash': Exec format error
ErrorErrorvexecuting '/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash': Exec format error
ErrorErrorvexecuting '/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash': Exec format error
error: builder for '/nix/store/s916g54n7dxxq710kbrb4m6p9d67n9wi-builder.pl.drv' failed with exit code 1
error: builder for '/nix/store/49pxhxla9a7vzs37qqnmbz51p8p294gz-steam-run.drv' failed with exit code 1
error: builder for '/nix/store/ys13s6nh0hw1mw3aj3mqb1ljp73wjj8c-steam-wrapper.sh.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/hwrcrl2r0f3w2yjzz1bgfrrk1rgga6g8-steam-init.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c3sbx1c074zcl74m841z7ll5plz456k5-steam-run-init.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bc5qdnh3y0rp4d1c29nwwda758qfrjpj-steam-run-usr-multi.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4jzr0ssdjd89lm3b92jbyxjvbyhrkxxc-steam-run-usr-target.drv' failed to build
error: 1 dependencies of derivation '/nix/store/k6djhk5nmz699p2406qpnj6bv7ss7770-steam-usr-multi.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gv84mqpjhwalaz9cwhbn7li6kdc8hyqz-steam-usr-target.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3nirfr9gbx5lqkw2rsz3yihwzs4mal5z-steam-run.drv' failed to build
error: 1 dependencies of derivation '/nix/store/18niiaa5xi0kpciy1kdrj5hf82i7744y-steam.drv' failed to build
building '/nix/store/z87ky7wyq3b39yasim214ryf7qwx21pm-steam_1.0.0.74.tar.gz.drv'...
error: 1 dependencies of derivation '/nix/store/97kfq19l85h1msv9dm9valzvdryybssp-steam-run.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mikmxpj6qm9sn6px9lc769hslyd37p68-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/qg06wfclc9j195qip0hbfgwq7j6kagk8-nixos-system-pinephone-22.05pre-git.drv' failed to build

Even remote build does not work.

  nix.buildMachines = [ {
    hostName = "nixos.lan";
    system = "x86_64-linux";
    maxJobs = 1;
    speedFactor = 2;
    supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
    mandatoryFeatures = [ ];
  }] ;
  nix.distributedBuilds = true;
copying path '/nix/store/6z7aq0f26r9mkbr7vwv2gz2fpfmjsi9q-libpulseaudio-15.0-dev' from 'https://cache.nixos.org'...
ErrorErrorvexecuting '/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash': Exec format error
ErrorErrorvexecuting '/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash': Exec format error
ErrorErrorvexecuting '/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash': Exec format error
error: builder for '/nix/store/s916g54n7dxxq710kbrb4m6p9d67n9wi-builder.pl.drv' failed with exit code 1
error: builder for '/nix/store/49pxhxla9a7vzs37qqnmbz51p8p294gz-steam-run.drv' failed with exit code 1
error: builder for '/nix/store/ys13s6nh0hw1mw3aj3mqb1ljp73wjj8c-steam-wrapper.sh.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/hwrcrl2r0f3w2yjzz1bgfrrk1rgga6g8-steam-init.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c3sbx1c074zcl74m841z7ll5plz456k5-steam-run-init.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bc5qdnh3y0rp4d1c29nwwda758qfrjpj-steam-run-usr-multi.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4jzr0ssdjd89lm3b92jbyxjvbyhrkxxc-steam-run-usr-target.drv' failed to build
error: 1 dependencies of derivation '/nix/store/k6djhk5nmz699p2406qpnj6bv7ss7770-steam-usr-multi.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gv84mqpjhwalaz9cwhbn7li6kdc8hyqz-steam-usr-target.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3nirfr9gbx5lqkw2rsz3yihwzs4mal5z-steam-run.drv' failed to build
error: 1 dependencies of derivation '/nix/store/18niiaa5xi0kpciy1kdrj5hf82i7744y-steam.drv' failed to build
building '/nix/store/z87ky7wyq3b39yasim214ryf7qwx21pm-steam_1.0.0.74.tar.gz.drv'...
error: 1 dependencies of derivation '/nix/store/97kfq19l85h1msv9dm9valzvdryybssp-steam-run.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mikmxpj6qm9sn6px9lc769hslyd37p68-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9sdlk2hws0af4i47apvy185cjg2qwbck-nixos-system-pinephone-22.05pre-git.drv' failed to build

So i built it on the machine and copied it over.

[davidak@gaming:~]$ nix-build 'https://github.com/NixOS/nixpkgs/archive/17c252aab1772d36acd6d3f57f6512f25b6f9e9c.tar.gz' -A steam

[davidak@gaming:~]$ nix-build 'https://github.com/NixOS/nixpkgs/archive/17c252aab1772d36acd6d3f57f6512f25b6f9e9c.tar.gz' -A steam-run

[davidak@gaming:~]$ nix copy --to ssh://root@10.0.10.238 /nix/store/fyaib4qjhzqwph6z54wvg7yaqa8r396n-steam
copying path '/nix/store/2nmh263sp39sz5mdvbnak3lrvs2a5gdv-steam-fhs' to 'ssh://root@10.0.10.238'

[davidak@gaming:~]$ nix copy --to ssh://root@10.0.10.238 /nix/store/6i8p17rhyz9m9gd5161inhry3dwdmj99-steam-run
copying path '/nix/store/24djwivsby1qp8w9sx4h32rwa3mjzpn4-steam-run-usr-multi' to 'ssh://root@10.0.10.238'

And rebuild a last time:

[root@pinephone:~]# nixos-rebuild switch -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/17c252aab1772d36acd6d3f57f6512f25b6f9e9c.tar.gz
1 Like

Cool!
I feel like there should be a way to do a remote build or build it in the own machine with emulation rather than having to manually copy builds from the store

Could it also be possible to realize something like this with box86/64 for better performance?