skip to Main Content

I tried to use nasm in a bash project on Replit (educator) but it failed as nasm was not installed.
However, there are some assembly projects on Replit. So I forked a project, added my code, and boom it worked.
How nasm got installed in that project? Dunno, cause it’s nowhere explained.

Now, I’d like to use external functions like printf in the assembly code. The code being x86-32, I need to install something similar to glibc-devel.i686 and glibc-devel (this on Fedora). Seems to be gcc-multilib in Ubuntu.

My question is : how do we install Linux packages in a bash project on Replit? Thanks for the help.

2

Answers


  1. Chosen as BEST ANSWER

    To install a Linux package in a bash project on Replit, run the command directly from the console or shell. If the command is found on Nix, you'll get an invite to run it from Nix and the package will be added to the config file replit.nix in your poject.

    > nasm --version
    nasm: command not installed, but was located via Nix.
    Would you like to run nasm from Nix and add it to your replit.nix file? [Yn]: 
    
    > cat replit.nix
    { pkgs }: {
        deps = [
            pkgs.nasm
            pkgs.bashInteractive
        ];
    }
    

    However, if the command you're trying to run is in a script, pressing the "Run" button or launching the script from the shell will only give an error "Command not found".

    You can also add the package to your project by directly editing replit.nix.

    You can check if your package exists in Nix using the NixOS Search - Packages page.


  2. In bash type:

    $ nix-env -iA nixpkgs.nasm
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search