Install a package on the Pubnix: Difference between revisions

From Project Segfault Wiki
(add remove pkg cmd)
(list installed pkgs)
 
Line 12: Line 12:
If you find the package you wanted on there, you can run: <pre>nix-env -iA nixpkgs.(package)</pre> and it will be installed! For example, you can run: <pre>nix-env -iA nixpkgs.neofetch</pre> and when that's complete <pre>neofetch</pre> will work on your user! If you want to install a package for only your session, you can run:
If you find the package you wanted on there, you can run: <pre>nix-env -iA nixpkgs.(package)</pre> and it will be installed! For example, you can run: <pre>nix-env -iA nixpkgs.neofetch</pre> and when that's complete <pre>neofetch</pre> will work on your user! If you want to install a package for only your session, you can run:
<pre>nix-shell -p (package)</pre>
<pre>nix-shell -p (package)</pre>
To list all your local installed packages, you can run:<pre>
nix-env -q
</pre>
And for all globally installed packages, you can run:<pre>
apt list --installed
</pre>
Finally, to remove a package, you can run:<pre>
Finally, to remove a package, you can run:<pre>
nix-env -e (package)
nix-env -e (package)
</pre>This article only includes the common commands. Check out the [https://nixos.wiki/wiki/Ubuntu_vs._NixOS Ubuntu vs. NixOS] page on the NixOS Wiki to get a cheatsheet on more!
</pre>This article only includes the common commands. Check out the [https://nixos.wiki/wiki/Ubuntu_vs._NixOS Ubuntu vs. NixOS] page on the NixOS Wiki to get a cheatsheet on more!
[[Category:Pubnix]]
[[Category:Pubnix]]

Latest revision as of 14:28, 22 March 2023

So you have a package you want to run...

No worries! The Project Segfault Pubnix has the Nix package manager installed, meaning that you can install a package in your user only. This allows for all the users to run basically whatever they want without requiring us to install it.

Step one is to find the package you want in nixpkgs. You can search packages at NixOS' search site.

Additionally, you can also search for packages from the CLI. For that, you can run:

nix search nixpkgs (package)

Note: Incase you used the nix search method, the package name will not include the legacyPackages.x86_64-linux part.

If you find the package you wanted on there, you can run:

nix-env -iA nixpkgs.(package)

and it will be installed! For example, you can run:

nix-env -iA nixpkgs.neofetch

and when that's complete

neofetch

will work on your user! If you want to install a package for only your session, you can run:

nix-shell -p (package)

To list all your local installed packages, you can run:

nix-env -q

And for all globally installed packages, you can run:

apt list --installed

Finally, to remove a package, you can run:

nix-env -e (package)

This article only includes the common commands. Check out the Ubuntu vs. NixOS page on the NixOS Wiki to get a cheatsheet on more!