This commit is contained in:
rycee 2024-06-26 22:21:17 +00:00
parent b1be543101
commit 60a462ced2

View file

@ -33,7 +33,7 @@
</div> </div>
<hr /> <hr />
</div> </div>
<div class="toc"> <p><strong>Table of Contents</strong></p> <dl class="toc"> <dt> <span class="preface"> <a href="index.xhtml#preface">Preface</a> </span></dt><dt> <span class="part"> <a href="index.xhtml#ch-installation">Installing Home Manager</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-install-standalone">Standalone installation</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-install-nixos-module">NixOS module</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-install-nix-darwin-module">nix-darwin module</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-usage">Using Home Manager</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-usage-configuration">Configuration Example</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-usage-rollbacks">Rollbacks</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-usage-dotfiles">Keeping your ~ safe from harm</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-usage-graphical">Graphical services</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-updating">Updating</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-nix-flakes">Nix Flakes</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-flakes-prerequisites">Prerequisites</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-flakes-standalone">Standalone setup</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-flakes-nixos-module">NixOS module</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-flakes-nix-darwin-module">nix-darwin module</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-writing-modules">Writing Home Manager Modules</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-option-types">Option Types</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-contributing">Contributing</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-contrib-getting-started">Getting started</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-guidelines">Guidelines</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-news">News</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-tests">Tests</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-3rd-party">Third-Party Tools and Extensions</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-3rd-party-module-collections">Module Collections</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-faq">Frequently Asked Questions (FAQ)</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#_why_is_there_a_collision_error_when_switching_generation">Why is there a collision error when switching generation?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_why_are_the_session_variables_not_set">Why are the session variables not set?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_how_to_set_up_a_configuration_for_multiple_users_machines">How to set up a configuration for multiple users/machines?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal">Why do I get an error message about <code class="literal">ca.desrt.dconf</code> or <code class="literal">dconf.service</code>?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_how_do_i_install_packages_from_nixpkgs_unstable">How do I install packages from Nixpkgs unstable?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_how_do_i_change_the_package_used_by_a_module">How do I change the package used by a module?</a> </span></dt></dl></dd><dt> <span class="appendix"> <a href="options.xhtml">A. Home Manager Configuration Options</a> </span></dt><dt> <span class="appendix"> <a href="nixos-options.xhtml">B. NixOS Configuration Options</a> </span></dt><dt> <span class="appendix"> <a href="nix-darwin-options.xhtml">C. nix-darwin Configuration Options</a> </span></dt><dt> <span class="appendix"> <a href="release-notes.xhtml">D. Release Notes</a> </span></dt> </dl></div> <div class="toc"> <p><strong>Table of Contents</strong></p> <dl class="toc"> <dt> <span class="preface"> <a href="index.xhtml#preface">Preface</a> </span></dt><dt> <span class="part"> <a href="index.xhtml#ch-introduction">Introduction to Home Manager</a> </span></dt><dt> <span class="part"> <a href="index.xhtml#ch-installation">Installing Home Manager</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-install-standalone">Standalone installation</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-install-nixos-module">NixOS module</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-install-nix-darwin-module">nix-darwin module</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-usage">Using Home Manager</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-usage-configuration">Configuration Example</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-usage-rollbacks">Rollbacks</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-usage-dotfiles">Keeping your ~ safe from harm</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-usage-graphical">Graphical services</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-updating">Updating</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-nix-flakes">Nix Flakes</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-flakes-prerequisites">Prerequisites</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-flakes-standalone">Standalone setup</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-flakes-nixos-module">NixOS module</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-flakes-nix-darwin-module">nix-darwin module</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-writing-modules">Writing Home Manager Modules</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-option-types">Option Types</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-contributing">Contributing</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-contrib-getting-started">Getting started</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-guidelines">Guidelines</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-news">News</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#sec-tests">Tests</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-3rd-party">Third-Party Tools and Extensions</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#sec-3rd-party-module-collections">Module Collections</a> </span></dt></dl></dd><dt> <span class="part"> <a href="index.xhtml#ch-faq">Frequently Asked Questions (FAQ)</a> </span></dt><dd><dl><dt> <span class="section"> <a href="index.xhtml#_why_is_there_a_collision_error_when_switching_generation">Why is there a collision error when switching generation?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_why_are_the_session_variables_not_set">Why are the session variables not set?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_how_to_set_up_a_configuration_for_multiple_users_machines">How to set up a configuration for multiple users/machines?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal">Why do I get an error message about <code class="literal">ca.desrt.dconf</code> or <code class="literal">dconf.service</code>?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_how_do_i_install_packages_from_nixpkgs_unstable">How do I install packages from Nixpkgs unstable?</a> </span></dt><dt> <span class="section"> <a href="index.xhtml#_how_do_i_change_the_package_used_by_a_module">How do I change the package used by a module?</a> </span></dt></dl></dd><dt> <span class="appendix"> <a href="options.xhtml">A. Home Manager Configuration Options</a> </span></dt><dt> <span class="appendix"> <a href="nixos-options.xhtml">B. NixOS Configuration Options</a> </span></dt><dt> <span class="appendix"> <a href="nix-darwin-options.xhtml">C. nix-darwin Configuration Options</a> </span></dt><dt> <span class="appendix"> <a href="release-notes.xhtml">D. Release Notes</a> </span></dt> </dl></div>
<div class="preface"> <div class="titlepage"> <div> <div> <h1 id="preface" class="title" >Preface </h1> </div> </div></div><p>This manual will eventually describe how to install, use, and extend Home <div class="preface"> <div class="titlepage"> <div> <div> <h1 id="preface" class="title" >Preface </h1> </div> </div></div><p>This manual will eventually describe how to install, use, and extend Home
Manager.</p><p>If you encounter problems then please reach out on the IRC channel Manager.</p><p>If you encounter problems then please reach out on the IRC channel
<a class="link" href="https://webchat.oftc.net/?channels=home-manager" target="_top">#home-manager</a> <a class="link" href="https://webchat.oftc.net/?channels=home-manager" target="_top">#home-manager</a>
@ -45,6 +45,18 @@ be reported on the
<a class="link" href="https://github.com/nix-community/home-manager/issues" target="_top">Home Manager issue tracker</a>.</p><div class="note"><h3 class="title">Note</h3><p>Commands prefixed with <code class="literal">$ sudo</code> have to be run as root, either <a class="link" href="https://github.com/nix-community/home-manager/issues" target="_top">Home Manager issue tracker</a>.</p><div class="note"><h3 class="title">Note</h3><p>Commands prefixed with <code class="literal">$ sudo</code> have to be run as root, either
requiring to login as root user or temporarily switching to it using requiring to login as root user or temporarily switching to it using
<code class="literal">sudo</code> for example.</p></div> <code class="literal">sudo</code> for example.</p></div>
</div><div class="part"> <div class="titlepage"> <div> <div> <h1 id="ch-introduction" class="title" >Introduction to Home Manager </h1> </div> </div></div><div class="partintro"><p>Home Manager is a <a class="link" href="https://nix.dev/" target="_top">Nix</a>-powered tool for reproducible management of the contents of users home directories.
This includes programs, configuration files, environment variables and, well… arbitrary files.
The following example snippet of Nix code:</p><pre><code class="programlisting nix">programs.git = {
enable = true;
userEmail = &quot;joe@example.org&quot;;
userName = &quot;joe&quot;;
};
</code></pre><p>would make available to a user the <code class="literal">git</code> executable and man pages and a configuration file <code class="literal">~/.config/git/config</code>:</p><pre><code class="programlisting ini">[user]
email = &quot;joe@example.org&quot;
name = &quot;joe&quot;
</code></pre><p>Since Home Manager is implemented in Nix, it provides several benefits:</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc;"><li class="listitem"><p>Contents are reproducible — a home will be the exact same every time it is built, unless of course, an intentional change is made.
This also means you can have the exact same home on different hosts.</p></li><li class="listitem"><p>Significantly faster and more powerful than various backup strategies.</p></li><li class="listitem"><p>Unlike “dotfiles” repositories, Home Manager supports specifying programs, as well as their configurations.</p></li><li class="listitem"><p>Supported by <a class="link" href="http://cache.nixos.org/" target="_top">http://cache.nixos.org/</a>, so that you dont have to build from source.</p></li><li class="listitem"><p>If you do want to build some programs from source, there is hardly a tool more useful than Nix for that, and the build instructions can be neatly integrated in your Home Manager usage.</p></li><li class="listitem"><p>Infinitely composable, so that values in different configuration files and build instructions can share a source of truth.</p></li><li class="listitem"><p>Connects you with the <a class="link" href="https://repology.org/repositories/statistics/total" target="_top">most extensive</a> and <a class="link" href="https://repology.org/repositories/statistics/newest" target="_top">most up-to-date</a> software package repository on earth, <a class="link" href="https://github.com/NixOS/nixpkgs" target="_top">Nixpkgs</a>.</p></li></ul></div></div>
</div><div class="part"> <div class="titlepage"> <div> <div> <h1 id="ch-installation" class="title" >Installing Home Manager </h1> </div> </div></div><div class="partintro"><p>Home Manager can be used in three primary ways:</p><div class="orderedlist"><ol class="orderedlist " type="1"><li class="listitem"><p>Using the standalone <code class="literal">home-manager</code> tool. For platforms other than </div><div class="part"> <div class="titlepage"> <div> <div> <h1 id="ch-installation" class="title" >Installing Home Manager </h1> </div> </div></div><div class="partintro"><p>Home Manager can be used in three primary ways:</p><div class="orderedlist"><ol class="orderedlist " type="1"><li class="listitem"><p>Using the standalone <code class="literal">home-manager</code> tool. For platforms other than
NixOS and Darwin, this is the only available choice. It is also NixOS and Darwin, this is the only available choice. It is also
recommended for people on NixOS or Darwin that want to manage their recommended for people on NixOS or Darwin that want to manage their