NixOS system configuration: Difference between revisions
Create page, move some content from Flakes, NixOs as a desktop, and Overview of the NixOS Linux distributions pages to here |
m edit "more through" -> more thorough |
||
| (4 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
[[NixOS]] uses a declarative configuration system that allows users to manage their entire operating system setup including installed packages, system services, user accounts, hardware settings, and more | [[NixOS]] uses a declarative configuration system that allows users to manage their entire operating system setup including installed packages, system services, user accounts, hardware settings, and more thorough configuration files. This page serves as an overview of how to work with and manage NixOS system configurations. | ||
For an introduction to declarative configuration, see the [[Overview of the NixOS Linux distribution#Declarative Configuration]] and the {{NixOS Manual|name=NixOS official manual|anchor=#ch-configuration}}. | For an introduction to declarative configuration, see the [[Overview of the NixOS Linux distribution#Declarative Configuration]] and the {{NixOS Manual|name=NixOS official manual|anchor=#ch-configuration}}. | ||
| Line 182: | Line 182: | ||
A NixOS config flake could be as follows (replace <hostname> with your hostname): | A NixOS config flake could be as follows (replace <hostname> with your hostname): | ||
{{file| | {{file|3=<nowiki> | ||
{ | { | ||
description = "NixOS configuration with two or more channels"; | description = "NixOS configuration with two or more channels"; | ||
inputs = { | inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos- | nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; | ||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; | nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
}; | }; | ||
| Line 199: | Line 199: | ||
nixpkgs.overlays = [ | nixpkgs.overlays = [ | ||
(final: prev: { | (final: prev: { | ||
unstable = import nixpkgs-unstable { | |||
inherit (final) config; | |||
inherit (final.stdenv.hostPlatform) system; | |||
}; | |||
}) | }) | ||
]; | ]; | ||
| Line 214: | Line 211: | ||
}; | }; | ||
} | } | ||
</nowiki> | </nowiki>|name=/etc/nixos/flake.nix|lang=nix}} | ||
}} | |||
{{file| | {{file|3=<nowiki> | ||
# can now use "pkgs.package" or "pkgs.unstable.package" | # can now use "pkgs.package" or "pkgs.unstable.package" | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
| Line 227: | Line 223: | ||
# ... | # ... | ||
} | } | ||
</nowiki> | </nowiki>|name=/etc/nixos/configuration.nix|lang=nix}} | ||
}} | |||
If the variable <code>nixpkgs</code> points to the flake, you can also define <code>pkgs</code> with overlays with: | If the variable <code>nixpkgs</code> points to the flake, you can also define <code>pkgs</code> with overlays with: | ||
| Line 335: | Line 330: | ||
* [[Updating NixOS]] - Updating the set of [[Nixpkgs]] the system uses | * [[Updating NixOS]] - Updating the set of [[Nixpkgs]] the system uses | ||
* [[NixOS as a | * [[NixOS as a desktop]] - Configuration tips for setting up NixOS as a desktop | ||
* [[Nixos-rebuild]] - Command to apply changes to system configuration | * [[Nixos-rebuild]] - Command to apply changes to system configuration | ||
| Line 343: | Line 338: | ||
* [[NixOS configuration editors]] - Recommendations for improving NixOS configuration experience | * [[NixOS configuration editors]] - Recommendations for improving NixOS configuration experience | ||
* [[Configuration Collection]] - Community member's NixOS | * [[Configuration Collection]] - Community member's NixOS configuration files for inspiration | ||
[[Category:NixOS]] | [[Category:NixOS]] | ||