NixOS as a desktop: Difference between revisions

From NixOS Wiki
imported>Nix
Make a good intro page to present what looks like the clearest path for new people to get started with using NixOS as a desktop
 
Haruki7049 (talk | contribs)
Marked this version for translation
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
NixOS can be used for many purposes. If you want to use it as a primary desktop operating system for your daily use (either on bare metal or as a secondary VM), this page is for you.
<languages/>
<translate>
<!--T:1-->
NixOS can be used for many purposes. If you want to use it as a primary desktop operating system for your daily use (either on bare metal or as a [https://twitter.com/mitchellh/status/1346136404682625024 secondary VM]), this page is for you. Even if your ambitions are to use NixOS in the cloud or on specially configured servers, you may want to start with the lessons outlined here in order to get more generally familiar with the Nix ecosystem.


== Installation ==
== Installation == <!--T:2-->


=== Wiki method ===
=== Wiki method === <!--T:3-->


<!--T:4-->
If you prefer reading, see [[NixOS Installation Guide]] to get started. For a well presented video option, see video guide section immediately below. Keep in mind that, for a desktop installation, you will probably want to make sure you start with at least 30 GiB of available disk space to allow for the desktop environments (e.g. GNOME, KDE, or XFCE), browsers (e.g. Firefox), and other graphical applications (e.g. VSCode) that would be typical of daily use. 15 GiB might be enough in a pinch for a fairly bare-bones setup.
If you prefer reading, see [[NixOS Installation Guide]] to get started. For a well presented video option, see video guide section immediately below. Keep in mind that, for a desktop installation, you will probably want to make sure you start with at least 30 GiB of available disk space to allow for the desktop environments (e.g. GNOME, KDE, or XFCE), browsers (e.g. Firefox), and other graphical applications (e.g. VSCode) that would be typical of daily use. 15 GiB might be enough in a pinch for a fairly bare-bones setup.


=== Video guide ===
=== Video guide === <!--T:5-->


<!--T:6-->
For a visual guide, see [[Wil T Nix Guides]]. The [[Wil_T_Nix_Guides#NixOS_Installation_Guide|second video]] is a concise installation guide. This 8-part series, produced in early 2021, also covers all the basics of using NixOS as a desktop and configuring it to your liking.
For a visual guide, see [[Wil T Nix Guides]]. The [[Wil_T_Nix_Guides#NixOS_Installation_Guide|second video]] is a concise installation guide. This 8-part series, produced in early 2021, also covers all the basics of using NixOS as a desktop and configuring it to your liking.


== Managing your configuration ==
== Managing your configuration == <!--T:7-->


It is possible to manage your entire configuration using the methods documented in the [https://nixos.org/manual/nixos/stable/index.html NixOS official manual]. However, most community members who use NixOS on the desktop prefer to manage their user configurations (e.g. "dotfiles") using [[Home Manager]]. Home Manager is a user oriented tool for declaring what you want installed and how you want it configured, and thus would be used in lieu of most settings you would otherwise put into a [https://nixos.org/manual/nixos/stable/#sec-changing-config configuration.nix] or through [[FAQ#How_can_I_manage_software_with_nix-env_like_with_configuration.nix.3F|nix-env]]
<!--T:8-->
It is possible to manage your entire configuration using the methods documented in the [https://nixos.org/manual/nixos/stable/index.html NixOS official manual]. However, most community members who use NixOS on the desktop prefer to manage their user configurations (e.g. "dotfiles") using [[Home Manager]] (citation needed). Home Manager is a user oriented tool for declaring what you want installed and how you want it configured, and thus would be used in lieu of most settings you would otherwise put into a [https://nixos.org/manual/nixos/stable/#sec-changing-config configuration.nix] or through [[FAQ#How_can_I_manage_software_with_nix-env_like_with_configuration.nix.3F|nix-env]]


=== Video guide ===
=== Video guide === <!--T:9-->


<!--T:10-->
Wil T's guides are about an even mix of:
Wil T's guides are about an even mix of:
# Hands-on bootstrapping to get to being able to very capably manage your system using Home Manager, git versioning, and eventually Flakes.
# Hands-on bootstrapping to get to being able to very capably manage your system using Home Manager, git versioning, and eventually Flakes.
# Conceptual overviews and general exposition of the Nix ecosystem, community, and available resources.
# Conceptual overviews and general exposition of the Nix ecosystem, community, and available resources.


<!--T:11-->
The [[Wil_T_Nix_Guides#NixOS_Installation_Guide|second video]], starting from about 27 minutes in, is also an introduction to and guide to setting up Home Manager.
The [[Wil_T_Nix_Guides#NixOS_Installation_Guide|second video]], starting from about 27 minutes in, is also an introduction to and guide to setting up Home Manager.


== Modularizing your configuration ==
== Modularizing your configuration == <!--T:12-->


If you want a more composable NixOS configuration setup, the still-experimental [[Flakes]] feature is causing a lot of excitement in the community. Managing flakes requires a good basic understanding and some existing hands on experience with the Nix ecosystem.
=== With NixOS Modules === <!--T:13-->


=== Video guide ===
<!--T:14-->
configuration.nix is an instance of a [[NixOS modules|NixOS module]], which makes it easy to break your configuration into several files. Modules can:


<!--T:15-->
* Import other modules
* Declare new options
* Provide values for options (this is what most of your default configuration.nix does)
* Reference option values from other modules (via the <code>config</code> attribute passed to all modules)
<!--T:16-->
As long as you declare options for any values you want to share between modules, you can divide your configuration however you like into files that get imported, directly or transitively, by your root configuration.nix file. You can also import modules from remote sources, using functions like <code>builtins.fetchTarball</code>. See the [[NixOS modules|wiki page]] or the [https://nixos.org/manual/nixos/stable/#sec-writing-modules NixOS manual] for more information.
=== With Flakes === <!--T:17-->
<!--T:18-->
If you want a more composable<sup>[citation needed]</sup> NixOS configuration setup, the still-experimental [[Flakes]] feature is causing a lot of excitement in the community. Managing flakes requires a good basic understanding and some existing hands on experience with the Nix ecosystem.
==== Video guide ==== <!--T:19-->
<!--T:20-->
Videos [[Wil_T_Nix_Guides#Intro_to_Flakes|seven]] and [[Wil_T_Nix_Guides#Moving_NixOS_System_Configuration_into_a_Flake|eight]] of Wil T's original 8-part series are a good overview of what Flakes enable and how to get started with them.
Videos [[Wil_T_Nix_Guides#Intro_to_Flakes|seven]] and [[Wil_T_Nix_Guides#Moving_NixOS_System_Configuration_into_a_Flake|eight]] of Wil T's original 8-part series are a good overview of what Flakes enable and how to get started with them.


== Beyond initial setup ==
== Beyond initial setup == <!--T:21-->


<!--T:22-->
After you are familiar with the Nix ecosystem and have a functional desktop install of NixOS, you will likely be interested in customizations and more detailed setup.
After you are familiar with the Nix ecosystem and have a functional desktop install of NixOS, you will likely be interested in customizations and more detailed setup.


=== Learn by example ===
=== Learn by example === <!--T:23-->
 
<!--T:24-->
If you are comfortable managing your system through a git repo using flakes, then there are many repositories you can learn from now!
 
<!--T:25-->
Check out [[Comparison of NixOS setups]] for a table comparing some popular choices.
 
<!--T:26-->
See [[Configuration Collection]] for a long list within the wiki.


If you are comfortable managing your system through a git repo using flakes, then the following topic searches on Github should uncover many useful examples.
<!--T:27-->
Additionally, the following topic searches on Github should uncover many useful examples.
* [https://github.com/topics/nix-flake nix-flake]
* [https://github.com/topics/nixos-configuration nixos-configuration]
* [https://github.com/topics/nixos-dotfiles nixos-dotfiles]
</translate>


*Github topic:
[[Category:Desktop]]
** [https://github.com/topics/nix-flake nix-flake]
[[Category:Guide]]
** [https://github.com/topics/nixos-configuration nixos-configuration]
** [https://github.com/topics/nixos-dotfiles nixos-dotfiles]

Latest revision as of 08:50, 10 November 2024

NixOS can be used for many purposes. If you want to use it as a primary desktop operating system for your daily use (either on bare metal or as a secondary VM), this page is for you. Even if your ambitions are to use NixOS in the cloud or on specially configured servers, you may want to start with the lessons outlined here in order to get more generally familiar with the Nix ecosystem.

Installation

Wiki method

If you prefer reading, see NixOS Installation Guide to get started. For a well presented video option, see video guide section immediately below. Keep in mind that, for a desktop installation, you will probably want to make sure you start with at least 30 GiB of available disk space to allow for the desktop environments (e.g. GNOME, KDE, or XFCE), browsers (e.g. Firefox), and other graphical applications (e.g. VSCode) that would be typical of daily use. 15 GiB might be enough in a pinch for a fairly bare-bones setup.

Video guide

For a visual guide, see Wil T Nix Guides. The second video is a concise installation guide. This 8-part series, produced in early 2021, also covers all the basics of using NixOS as a desktop and configuring it to your liking.

Managing your configuration

It is possible to manage your entire configuration using the methods documented in the NixOS official manual. However, most community members who use NixOS on the desktop prefer to manage their user configurations (e.g. "dotfiles") using Home Manager (citation needed). Home Manager is a user oriented tool for declaring what you want installed and how you want it configured, and thus would be used in lieu of most settings you would otherwise put into a configuration.nix or through nix-env

Video guide

Wil T's guides are about an even mix of:

  1. Hands-on bootstrapping to get to being able to very capably manage your system using Home Manager, git versioning, and eventually Flakes.
  2. Conceptual overviews and general exposition of the Nix ecosystem, community, and available resources.

The second video, starting from about 27 minutes in, is also an introduction to and guide to setting up Home Manager.

Modularizing your configuration

With NixOS Modules

configuration.nix is an instance of a NixOS module, which makes it easy to break your configuration into several files. Modules can:

  • Import other modules
  • Declare new options
  • Provide values for options (this is what most of your default configuration.nix does)
  • Reference option values from other modules (via the config attribute passed to all modules)

As long as you declare options for any values you want to share between modules, you can divide your configuration however you like into files that get imported, directly or transitively, by your root configuration.nix file. You can also import modules from remote sources, using functions like builtins.fetchTarball. See the wiki page or the NixOS manual for more information.

With Flakes

If you want a more composable[citation needed] NixOS configuration setup, the still-experimental Flakes feature is causing a lot of excitement in the community. Managing flakes requires a good basic understanding and some existing hands on experience with the Nix ecosystem.

Video guide

Videos seven and eight of Wil T's original 8-part series are a good overview of what Flakes enable and how to get started with them.

Beyond initial setup

After you are familiar with the Nix ecosystem and have a functional desktop install of NixOS, you will likely be interested in customizations and more detailed setup.

Learn by example

If you are comfortable managing your system through a git repo using flakes, then there are many repositories you can learn from now!

Check out Comparison of NixOS setups for a table comparing some popular choices.

See Configuration Collection for a long list within the wiki.

Additionally, the following topic searches on Github should uncover many useful examples.