Hello, I am extremely new to Nix/NixOS and am assuming that I am missing something really simple here, but I am having a lot of trouble running a program that is already built as an ELF without access to the source code. The program in question is Texas Instrument’s Code Composer Studio (CCS), which I couldn’t locate by searching Nix Packages.
When I first downloaded TI-CCS, I tried to run the executable like on a standard Linux distro and was referred to this article in the console output. The method here suggests using autoPatchelfHook
in a Nix expression to “package it in your own configuration”. I have not done this before, so I went through the tutorial “Packaging Existing Software with Nix”, which was a great introduction, but doesn’t include much information on patching ELF headers. I also reviewed the section in the manual on autoPatchelfHook
(here) as well as this blog post, which I also found helpful.
The issue comes in at my inability to combine this information when trying to get this thing running.
Here is a list of the steps I have taken:
- I set up a directory for configuring the builder. In my case, this directory is `/home/zach/dev/TI_CCS
- Inside the
TI_CCS
directory, I have created two files,default.nix
andTI_CCS.nix
.
Here is my default.nix
file:
# default.nix
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
pkgs = import nixpkgs { config = { }; overlays = [ ]; };
in
{
TI_CCS = pkgs.callPackage ./TI_CCS.nix { };
}
And here is my TI_CCS.nix
file:
# TI_CCS.nix
{ stdenv, fetchzip, autoPatchelfHook }:
stdenv.mkDerivation {
pname = "TI_CCS";
version = "12.7.1";
src = fetchzip {
url = "https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-J1VdearkvK/12.7.1/CCS12.7.1.00001_linux-x64.tar.gz";
sha256 = "0WxZ6Rnc4Q9XS8QTLHtwnfALJSq3nVJcOXObp4LI7L0=";
};
buildInputs = [ autoPatchelfHook ];
patchInstructions = ''
addAutoPatchelf --no-recurse $packageBaseDir
'';
installPhase = ''
mkdir -p $out/bin
cp TI_CCS $out/bin
'';
}
Please note that at this point, I have not tried to include dependencies, but if I run patchelf --print-needed ccs_setup_12.7.0.00007.run
(this is the executable contained in the tarball direct from the TI webpage), I get:
$ patchelf --print-needed ccs_setup_12.7.0.00007.run
libm.so.6
libdl.so.2
libpthread.so.0
libc.so.6
Now, when I try to run nix-build -A TI_CCS
, I get the following:
$ nix-build -A TI_CCS
this derivation will be built:
/nix/store/v82rhwwisc0ab5gw5l533krfxsx760ms-TI_CCS-12.7.1.drv
building '/nix/store/v82rhwwisc0ab5gw5l533krfxsx760ms-TI_CCS-12.7.1.drv'...
unpacking sources
unpacking source archive /nix/store/mm6kr5clpmfrimng427zg01sxhz5vi3l-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
cp: cannot stat 'TI_CCS': No such file or directory
error: builder for '/nix/store/v82rhwwisc0ab5gw5l533krfxsx760ms-TI_CCS-12.7.1.drv' failed with exit code 1;
last 10 log lines:
> unpacking sources
> unpacking source archive /nix/store/mm6kr5clpmfrimng427zg01sxhz5vi3l-source
> source root is source
> patching sources
> configuring
> no configure script, doing nothing
> building
> no Makefile, doing nothing
> installing
> cp: cannot stat 'TI_CCS': No such file or directory
For full logs, run 'nix log /nix/store/v82rhwwisc0ab5gw5l533krfxsx760ms-TI_CCS-12.7.1.drv'.
I don’t think I need to be concerned about the no configure script and no Makefile since the ELF is already in the package?
Finally, here is the full log:
$ nix log /nix/store/v82rhwwisc0ab5gw5l533krfxsx760ms-TI_CCS-12.7.1.drv
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/v82rhwwisc0ab5gw5l533krfxsx760ms-TI_CCS-12.7.1.drv^*'
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/mm6kr5clpmfrimng427zg01sxhz5vi3l-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
no Makefile, doing nothing
@nix { "action": "setPhase", "phase": "installPhase" }
installing
cp: cannot stat 'TI_CCS': No such file or directory
I know that I’m more than likely not configuring something correctly, but honestly do not have enough experience to know what. I would appreciate any input or advice I could get; I need this program for my coursework at university. I have an Arch install on a different drive that I could revert to in a pinch, but I would really like to get things working on this NixOS install, if possible.
Thanks,
Zach