Last active
September 21, 2023 18:30
-
-
Save bitsnaps/faf20af8e5b719d2741cdd74d3365e7f to your computer and use it in GitHub Desktop.
Replit & NixOS cheat sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NixOS is a Linux distribution built on top of the Nix package manager, known for its declarative and reproducible approach to system configuration. | |
# read more: https://nixos.org/ | |
# Replit uses NixOS under the hood in order with Nix which is a tool for managing packages and system configurations. | |
#https://docs.replit.com/programming-ide/nix-on-replit | |
# Update nix packages | |
nix-channel --update | |
# list all nix channels | |
cd ~/.nix-defexpr/channels | |
for channel in nixpkgs-* | |
do echo ${channel#*-} | |
done | |
# current channels: https://channels.nix.gsc.io/ | |
# you can add packages at `replit.nix`, here we add node-18 | |
```replit.nix | |
{ pkgs }: { | |
deps = [ | |
pkgs.nodejs-18_x | |
pkgs.sudo | |
pkgs.unixtools.netstat | |
pkgs.deno | |
]; | |
env = { | |
NIXPKGS_ALLOW_INSECURE="1"; | |
}; | |
} | |
``` | |
# P.S: Here we've added `NIXPKGS_ALLOW_INSECURE` to the Nix environnement variables. | |
# You can find more packages at: https://search.nixos.org/packages | |
# Replit also has its own package manager `upm` which a Universal Package Manager for Python, Node, Ruby and more... | |
```bash | |
$ upm --help | |
Usage: | |
upm [command] | |
Available Commands: | |
which-language Query language autodetection | |
list-languages List supported languages | |
search Search for packages online | |
info Show package information from online registry | |
add Add packages to the specfile | |
remove Remove packages from the specfile | |
lock Generate the lockfile from the specfile | |
install Install packages from the lockfile | |
list List packages from the specfile (or lockfile) | |
guess Guess what packages are needed by your project | |
show-specfile Print the filename of the specfile | |
show-lockfile Print the filename of the lockfile | |
show-package-dir Print the directory where packages are installed | |
help Help about any command | |
``` | |
# find out more at: https://github.com/replit/upm | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment