Skip to content

SP Flash Tool: Include Compatibility for Nix-based systems #219

@Kreyren

Description

@Kreyren

The SP Flash Tool fails on NixOS/NiXium, because it's missing various libraries:

$ ./flash_tool.sh 
~/.../SP_Flash_Tool_v5.2228_Linux/flash_tool: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory
~/.../SP_Flash_Tool_v5.2228_Linux/flash_tool: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
~/.../SP_Flash_Tool_v5.2228_Linux/flash_tool: error while loading shared libraries: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
...

This happens, because nix-based systems are not complying to the FHS 3.0 standard and/or do not provide the required libraries by design and instead expect declarative environment or getting the software declared as package.

To make it easier for nix users please include the following as shell.nix in SP Flash Tool:

{ pkgs ? import <nixpkgs> { config.allowUnfree = true; } }:

let
  fhs = pkgs.buildFHSEnv {
    name = "sp-flash-tool-fhs";
    targetPkgs = pkgs: with pkgs; [
      xorg.libXrender
      xorg.libSM
      xorg.libICE
      xorg.libX11
      xorg.libXext
      xorg.libXtst

      glibc
      glib
      zlib
      libGL
      fontconfig
      freetype

      libusb1
      dbus
      udev
    ];
    runScript = "bash";
  };
in
  fhs.env

This way nix user can just cd to the directory of SP Flash Tool and invoke nix-shell to get a temporary environment from which the SP Flash Tool will then work painlessly:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions