2

Nix on WSL Debian/Ubuntu

 8 months ago
source link: https://gist.github.com/ruandre/2d5618ce5be5123462300c7f418536e2
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Nix on WSL Debian/Ubuntu

Install these if not already available:

sudo apt install curl xz-utils

OR using build-essential (includes gcc, xz-utils, etc.)

sudo apt install curl build-essential

Steps

sudo mkdir /nix
sudo chown username /nix # replace `username` with your own

sh <(curl -L https://nixos.org/nix/install) --no-daemon

nix-env -i hello # install to test
nix-env --uninstall hello # remove test
# see https://search.nixos.org/packages
nix-env -qa > nix-packages.list

# see https://nixos.org/nix/manual
nix-env -i neovim # example install

# optimise store
nix-store --optimise -v

Auto-optimise store when writing new files to it:

mkdir -p ~/.config/nix

echo "auto-optimise-store = true" >> ~/.config/nix/nix.conf

Aliases

Faster to type:

alias nxi='nix-env -i'  # install
alias nxu='nix-env -u'  # update
alias nxr='nix-env -e'  # remove
alias nxls='nix-env -q' # list
alias nxgc='nix-collect-garbage -d'

Source

https://ariya.io/2020/05/nix-package-manager-on-ubuntu-or-debian


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK