basant/raw/public-kitaab/201019-1905.wiki
2021-12-01 00:24:51 +10:00

48 lines
1.1 KiB
Plaintext

%title NixOS Quick Tips
:nix:dev:ops:
%date 2020-10-19 19:05
install a package:
`nix-env -i hello` <-- not reproducible and hence not advisable
or
edit `/etc/nixos/configuration.nix` to ensure system wide install
`nixos-rebuild switch` <-- create new generation
`nixos-rebuild test` <-- only active while computer on
`sudo nixos-rebuild test -I nixpkgs=~/usr/nixpkgs/`
^-- use local repo to build pkgs
find out where in the store a binary is:
`readlink -f $(which hello)`
search packages
`nix-env -qaP '.*hello.*'`
or
`nix search <pkg>`
search nix package options
`nixos-option <option>`
clear up space:
`nix-collect-garbage -d`
upgrade to new channel:
`nix-channel --list` # show what version we're on
`nix-channel --add https://nixos.org/channels/nixos-XX.XX nixos`
`nix-channel --update`
`nixos-rebuild switch`
use a package through nix-shell:
`nix-shell -p <package>`
list generations
`nix-env --list-generations`
list installed packages
`nixos-option environment.systemPackages`
or
`nix-env --query`
install a nixOS .nix file through nix package manager
`nix-env -f nvim.nix -i neovim`