wiki/Install_a_package_on_the_Pubnix.html

32 lines
1.8 KiB
HTML
Raw Permalink Normal View History

2024-06-24 19:40:54 +05:30
<!--
title: Install a package on the Pubnix
description:
published: true
date: 2024-06-23T17:36:49.497Z
tags: pubnix
editor: ckeditor
dateCreated: 2024-06-23T17:09:03.666Z
-->
<h2>So you have a package you want to run…</h2>
<p>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.</p>
<p>Step one is to find the package you want in nixpkgs. You can search packages at <a href="https://search.nixos.org/packages">NixOS' search site</a>.</p>
<p>Additionally, you can also search for packages from the CLI. For that, you can run:</p>
<p><code>nix search nixpkgs (package)</code></p>
<p>Note: Incase you used the nix search method, the package name will not include the legacyPackages.x86_64-linux part.</p>
<p>If you find the package you wanted on there, you can run:</p>
<p><code>nix-env -iA nixpkgs.(package)</code></p>
<p>and it will be installed! For example, you can run:</p>
<p><code>nix-env -iA nixpkgs.neofetch</code></p>
<p>and when that's complete</p>
<p><code>neofetch</code></p>
<p>will work on your user! If you want to install a package for only your session, you can run:</p>
<p><code>nix-shell -p (package)</code></p>
<p>To list all your local installed packages, you can run:</p>
<p><code>nix-env -q</code></p>
<p>And for all globally installed packages, you can run:</p>
<p><code>apt list --installed</code></p>
<p>Finally, to remove a package, you can run:</p>
<p><code>nix-env -e (package)</code></p>
<p>This article only includes the common commands. Check out the <a href="https://nixos.wiki/wiki/Ubuntu_vs._NixOS">Ubuntu vs. NixOS</a> page on the NixOS Wiki to get a cheatsheet on more!</p>