Nixos-generate-config: Difference between revisions

Pigs (talk | contribs)
Includes usage and fill out details
Pigs (talk | contribs)
move ssd trim info to filesystems wiki page, other minor formatting
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Generate NixOS configuration modules.
Generate NixOS configuration modules.


This command is part of the <code>nixos-install-tools</code> package. It analyzes your hardware configuration and generates two files of:
This command is part of the {{nixos:package|nixos-install-tools}} package. It analyzes your hardware configuration and generates two files of:
* <code>/etc/nixos/configuration.nix</code> - the main system configuration file.
* <code>/etc/nixos/configuration.nix</code> - the main system configuration file.
* <code>/etc/nixos/hardware-configuration.nix</code> - a hardware-specific configuration file, including detected devices and modules.
* <code>/etc/nixos/hardware-configuration.nix</code> - a hardware-specific configuration file, including detected devices and modules.
For details on configuring the system configuration file, see [[Overview of the NixOS Linux distribution#Declarative Configuration]].


= Usage =
= Usage =


<syntaxHighlight lang=bash>
<syntaxHighlight lang=console>
# nixos-generate-config
# nixos-generate-config
</syntaxHighlight>
</syntaxHighlight>
Line 17: Line 19:
To generate configuration files with a specific root directory (commonly used during installation):
To generate configuration files with a specific root directory (commonly used during installation):


<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
# nixos-generate-config --root /mnt
# nixos-generate-config --root /mnt
</syntaxhighlight>
</syntaxhighlight>
Line 27: Line 29:
To print the detected hardware configuration to standard output without writing to disk:
To print the detected hardware configuration to standard output without writing to disk:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="console">
# nixos-generate-config --show-hardware-config
# nixos-generate-config --show-hardware-config
</syntaxhighlight>
</syntaxhighlight>


= Hardware specific notes =
= Specifying specific hardware =


If you are using an SSD it may be useful to enable TRIM support as well as set filesystem flags to improve the SSD performance:
A collection of hardware specific platforms with their config can be found at [https://github.com/NixOS/nixos-hardware NixOS Hardware repository].  
{{file|/etc/nixos/configuration.nix|nix|
<nowiki>
fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];
</nowiki>
}}


A collection of hardware specific platforms with their config can be found at [https://github.com/NixOS/nixos-hardware NixOS Hardware repository]
[[Category:NixOS]]
[[Category:Configuration]]