Running binary installers in install phase

I am trying to build a nix flake for TI’s Code Composer Studio which has a binary installer.
That installer extracts some shell scripts that has some hardcoded paths inside.
So far I was able to run the installer in steam-run and it works but I can not run that in the flake as it can not find libcrypt.
Patching the installer binary gets me to the scripts with the hardcoded paths, which I can not path as they are extracted and executed from the installer.
What would be the best way to work around this?

You might need libxcrypt-legacy.

Thanks that helped, I had to add some other libraries

Hi, did you publish your solution somewhere? I would like to do the same thing (i.e., install TI Code Composer Studio).

thanks in advance

I got it running with steam-run. Can post my solution later

that would be very helpful. thank you

not my best nix flake but it works. Suggestion are very welcome.
replace <your_cpu> and <your_required_library> as you need it.
flake.nix

{
  description = "CodeComposerStudio";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
  };

  outputs = {self, nixpkgs}: {
    packages.x86_64-linux= {
      CodeComposerStudio =
        with import nixpkgs {
          system = "x86_64-linux";
          config.allowUnfree = true;
          config.permittedInsecurePackages = [
                  "python-2.7.18.7"
                ];
          config.packageOverrides = pkgs: {
            steam = pkgs.steam.override {
              extraPkgs = pkgs: with pkgs; [
                libxcrypt-legacy
                python2
                ncurses5
                libusb-compat-0_1
              ];
            };
          };

        };

      stdenv.mkDerivation rec {
        name = "CodeComposerStudio-${version}";
        version = "12.6.0";
        build = "00008";
        src = pkgs.fetchurl {
          url = "https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-J1VdearkvK/${version}/CCS${version}.${build}_linux-x64.tar.gz";
          sha256 = "sha256-UBzThgBSy5oJfIZGE5RgMlVkCNh/16jtoYF/J0INBOc=";
        };

        desktopItem = makeDesktopItem {
          type = "Application";
          terminal = false;
          name = "Code Composer Studio";
          exec = "ccs";
          icon = "ccs";
          comment = "Texas Instruments Code Composer Studio";
          desktopName = "Code Composer Studio";
          genericName = "Code Composer Studio";
          categories = [ "Development" ];
        };


        buildInputs = [
            openssl
            zlib
            glib
            jdk
            unzip
            steam-run
       ];

        sourceRoot = ".";
        installPhase = ''
          runHook preInstall
          steam-run ./CCS${version}.${build}_linux-x64/ccs_setup_${version}.${build}.run --mode unattended --enable-components <your_cpu> --prefix /build/ti/
         # compile the libraries for your target arch
          PATH=/build/ti/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS/bin:$PATH steam-run /build/ti/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS/lib/mklib --pattern <your_required_library>.lib
          mv /build/ti $out


          mkdir -p $out/share/icons
          ln -s $out/ccs/doc/ccs.ico $out/share/icons/ccs.ico

          mkdir -p $out/share/applications
          cp ${desktopItem}/share/applications/* $out/share/applications

          mkdir -p $out/bin
          echo "#! /usr/bin/env bash" > $out/bin/ccs
          echo "steam-run $out/ccs/eclipse/ccstudio" >> $out/bin/ccs
          chmod oug+x $out/bin/ccs

          '';

        meta = with lib; {
          homepage = "https://ti.org";
          description = "CodeComposerStudio";
          platforms = platforms.linux;
        };
      };
      default = self.packages.x86_64-linux.CodeComposerStudio;
    };
  };
}

Please note that steam-run just exposes the fhsenv used by steam for use via interactive shell. If you’re packaging something, it’s better to use buildFHSEnv directly.