Ubuntu vs. NixOS: Difference between revisions

imported>Fricklerhandwerk
remove redundant blurb
Vater (talk | contribs)
see also added
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Wide page}}
<!-- TODO''': Provide well-commented sample configuration.nix and ~/.nixpkgs/config.nix files with examples of common tasks. -->
 
== Ubuntu vs. NixOS ==


The system-wide column is the equivalent of using <code>apt</code> under Ubuntu.
<!-- TODO''': Provide well-commented sample configuration.nix and ~/.nixpkgs/config.nix files with examples of common tasks. -->
<div class="table-responsive">
<div class="table-responsive">
{| class="wikitable"
{| class="wikitable"
Line 36: Line 32:
|Where are packages installed?
|Where are packages installed?
|apt installs globally into /bin/, /usr/, etc.
|apt installs globally into /bin/, /usr/, etc.
|System-wide packages are in /run/current-system/sw/ (these are installed because of /etc/nixos/configuration.nix) and /nix/var/nix/profiles/default/bin/ (this is the profile managed by root). Note that the files are just symlinks to the real packages managed by nix /nix/store/.
|System-wide packages are in /run/current-system/sw/ (these are installed because of /etc/nixos/configuration.nix) and /nix/var/nix/profiles/default/bin/ (this is the profile managed by root). Note that the files are just symlinks to the real packages managed by nix in /nix/store/.
|User packages are in ~/.nix-profile/. Note that the files are just symlinks to the real packages managed by nix in /nix/store/.
|User packages are in ~/.nix-profile/. Note that the files are just symlinks to the real packages managed by nix in /nix/store/.
|-
|-
Line 106: Line 102:
|<syntaxhighlight lang="console">$ sudo apt-get update</syntaxhighlight>
|<syntaxhighlight lang="console">$ sudo apt-get update</syntaxhighlight>
|<syntaxhighlight lang="console">$ sudo nix-channel --update</syntaxhighlight>
|<syntaxhighlight lang="console">$ sudo nix-channel --update</syntaxhighlight>
|<syntaxhighlight lang="console">$nix-channel --update</syntaxhighlight>
|<syntaxhighlight lang="console">$ nix-channel --update</syntaxhighlight>
|-
|-
|Upgrade packages
|Upgrade packages
Line 164: Line 160:
|Install a particular version of a package
|Install a particular version of a package
|<syntaxhighlight lang="console">$ apt-get install package=version</syntaxhighlight>
|<syntaxhighlight lang="console">$ apt-get install package=version</syntaxhighlight>
|Although Nix on its own doesn't understand the concept of package versioning, you can install and play with older (or newer!) software via https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs with https://lazamar.co.uk/nix-versions.
|Although Nix on its own doesn't understand the concept of package versioning, you can install and play with older (or newer!) software via [[FAQ/Pinning Nixpkgs]] with https://lazamar.co.uk/nix-versions.




Line 189: Line 185:
|Find packages
|Find packages
|<syntaxhighlight lang="console">$ apt-cache search emacs</syntaxhighlight>
|<syntaxhighlight lang="console">$ apt-cache search emacs</syntaxhighlight>
|<syntaxhighlight lang="console">$ nix-env -qaP '.*emacs.*'</syntaxhighlight> or <syntaxhighlight lang="console">$ nix search emacs</syntaxhighlight>
|<syntaxhighlight lang="console">$ nix-env -qaP '.*emacs.*'</syntaxhighlight> or <syntaxhighlight lang="console">$ nix search nixpkgs emacs</syntaxhighlight>
|<syntaxhighlight lang="console">$ nix-env -qaP '.*emacs.*'</syntaxhighlight> or <syntaxhighlight lang="console">$ nix search emacs</syntaxhighlight>
|<syntaxhighlight lang="console">$ nix-env -qaP '.*emacs.*'</syntaxhighlight> or <syntaxhighlight lang="console">$ nix search nixpkgs emacs</syntaxhighlight>
|-
|-
|Show package description
|Show package description
Line 292: Line 288:
|Install dpkg with Nix, then <syntaxhighlight lang="bash">dpkg -i package.deb</syntaxhighlight> While this is technically possible it will in all likelihood not work.
|Install dpkg with Nix, then <syntaxhighlight lang="bash">dpkg -i package.deb</syntaxhighlight> While this is technically possible it will in all likelihood not work.
|}
|}
</div>


</div>
== See also ==
 
* [[Cheatsheet]]
* https://nixcademy.com/cheatsheet/
** https://nixcademy.com/downloads/cheatsheet.pdf
 
[[Category:Cookbook]]