How do I use `apt install` in Repl.it / Nix?

I’m using Remotion and since Repl.it uses Ubuntu Linux. I have to install some packages using apt install to make it work.

The issue is when I do so, Replit says:

You don't need to use apt install in Replit, instead you add
system packages to the replit.nix file. Please see Using Nix
with Replit for documentation:

https://docs.replit.com/programming-ide/nix-on-replit

Here’s what I’m trying to install:

apt install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget libgbm-dev

The error message says that I don’t “need” to use it… so why can’t I use it regardless… I don’t need to use it, but I want to…

Anyways, what can I do to install those packages?

You can use the package tool at the left-bottom side of your replit.

Or you can manually edit the replit.nix file and add each package

{ pkgs }: {
  deps = [
    pkgs.libasound2
    pkgs.libcairo2
    # Just go by adding the packages
  ];
}
1 Like

Thanks for the response.
When I do that, I get this error on dependencies with hyphens:

Try searching Nix for the packages you need:
https://search.nixos.org/packages

1 Like

Don’t include the version numbers in the name.
It is better to search for and install using the System dependencies tool, or search on search.nixos.org for the correct package name.

Yes, I’ve done this. Many (if not, all) of these packages don’t exist on NixOS.org. But they do exist. The first one, for example:
https://packages.debian.org/buster/gconf-service

After a quick Google, I found that Debian and NixOS are similar services (kinda like an Android vs iOS situation).

So, is it just impossible to install these packages on Replit?.. If so, it’d be quite dumb for Replit to purposely limit what their service can do it by not even offering a roundabout way of installing Demian-specific packages.

They aren’t version numbers. The numbers are a part of the package’s names, for instance: libgdk-pixbuf2.0-0 package details

Just read this reddit thread, try using nix-env queries.

image
I tried to use their example code. It provides no response/feedback for exactly 30 seconds, and then just says “Killed”.

Here: I query for every package I care about

Because of that error, I deleted the replit.nix file and now I simply just get “Killed” with no error.

After consulting with GPT-4 it says this likely happens to due a lack of system resources required, so I thought this screenshot might be useful: