Skip to content

Commit 5ca4b31

Browse files
committed
deploy: 3aca18a
1 parent 01475fe commit 5ca4b31

File tree

7 files changed

+152
-42
lines changed

7 files changed

+152
-42
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
cp -r /nix/store/jqhmj92wimia35fw1rnp3kkbv5qrymyx-source/* .
1+
cp -r /nix/store/0gk4l64rg6l2w5fqqhp5b2wgxbgn7lp3-source/* .
22
/nix/store/kf6w5gcp13nl0k6q7ymp0p5mycmxpk1i-mdbook-0.4.40/bin/mdbook build --dest-dir "$out"

env-vars

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ declare -x HOME="/homeless-shelter"
33
declare -x HOST_PATH="/nix/store/0kg70swgpg45ipcz3pr2siidq9fn6d77-coreutils-9.5/bin:/nix/store/fnq94lw19pnwdl9p8zhfrad4jmlgxlbr-findutils-4.10.0/bin:/nix/store/7jk4jrd99ngnm9iczcf63mfxqba0ak2y-diffutils-3.10/bin:/nix/store/gjlh1zvckhz0qv795lnzgw2zciklbzj2-gnused-4.9/bin:/nix/store/vsyc8jhsr4d9lm2r8yqq9n3j4i66inlj-gnugrep-3.11/bin:/nix/store/9hifsxkcrkvvb712ghnr3gy5g1aiym2d-gawk-5.2.2/bin:/nix/store/l2l5xr2zczq19gqpqz4j8vxxia1j41s1-gnutar-1.35/bin:/nix/store/164s7a7yscnicprzrr78bvk45d77a3yg-gzip-1.13/bin:/nix/store/f8p74dj4r4my8sw5prmm3y4ddkz7591j-bzip2-1.0.8-bin/bin:/nix/store/axrdky652lsmif6m5i8b55q91v4ly4gy-gnumake-4.4.1/bin:/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin:/nix/store/7wg4bz2sika3wd7541rndbnwcq6k9h8v-patch-2.7.6/bin:/nix/store/02mf752h7f5fn7989awzca4ygy94k7w7-xz-5.6.2-bin/bin:/nix/store/fv56zpi80jpakbfmv16r60xvyqwzff6r-file-5.45/bin"
44
declare -x NIX_BUILD_CORES="4"
55
declare -x NIX_BUILD_TOP="/build"
6-
declare -x NIX_CFLAGS_COMPILE=" -frandom-seed=2d9rrhrkac"
6+
declare -x NIX_CFLAGS_COMPILE=" -frandom-seed=gragpkx7yq"
77
declare -x NIX_ENFORCE_NO_NATIVE="1"
88
declare -x NIX_ENFORCE_PURITY="1"
9-
declare -x NIX_LDFLAGS="-rpath /nix/store/2d9rrhrkac773py3m1wzlwzj0s7sbzi4-nixos-anywhere-docs/lib "
9+
declare -x NIX_LDFLAGS="-rpath /nix/store/gragpkx7yq88pzzdndyp7vpv0myijyfi-nixos-anywhere-docs/lib "
1010
declare -x NIX_LOG_FD="2"
1111
declare -x NIX_SSL_CERT_FILE="/no-cert-file.crt"
1212
declare -x NIX_STORE="/nix/store"
@@ -46,7 +46,7 @@ declare -x enableParallelInstalling="1"
4646
declare -x mesonFlags=""
4747
declare -x name="nixos-anywhere-docs"
4848
declare -x nativeBuildInputs=""
49-
declare -x out="/nix/store/2d9rrhrkac773py3m1wzlwzj0s7sbzi4-nixos-anywhere-docs"
49+
declare -x out="/nix/store/gragpkx7yq88pzzdndyp7vpv0myijyfi-nixos-anywhere-docs"
5050
declare -x outputs="out"
5151
declare -x passAsFile="buildCommand"
5252
declare -x patches=""

print.html

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,26 +264,9 @@ <h3 id="2-initialize-a-flake"><a class="header" href="#2-initialize-a-flake">2.
264264
into a new directory. This example is tailored for a virtual machine setup
265265
similar to one on <a href="https://www.hetzner.com/cloud">Hetzner Cloud</a>, so you might
266266
need to adapt it for your setup.</p>
267-
<p><strong>Hardware-Specific Configuration</strong>: If you're not using a virtual machine,
268-
you'll need to generate a custom hardware configuration with
269-
<code>nixos-generate-config</code>.</p>
270267
<p>If you already have a flake, you can use it by adding
271268
<a href="https://github.com/nix-community/disko?tab=readme-ov-file#how-to-use-disko">disko configuration</a>
272269
to it.</p>
273-
<h4 id="get-nixos-generate-config-onto-the-target-machine"><a class="header" href="#get-nixos-generate-config-onto-the-target-machine">Get <code>nixos-generate-config</code> onto the Target Machine</a></h4>
274-
<ol>
275-
<li><strong>Option 1</strong>: If NixOS is not installed, boot into an installer without first
276-
installing NixOS.</li>
277-
<li><strong>Option 2</strong>: Use the kexec tarball method, as described
278-
<a href="https://github.com/nix-community/nixos-images#kexec-tarballs">here</a>.</li>
279-
</ol>
280-
<h4 id="generate-configuration"><a class="header" href="#generate-configuration">Generate Configuration</a></h4>
281-
<p>Run the following command on the target machine:</p>
282-
<pre><code class="language-bash">nixos-generate-config --no-filesystems --dir /mnt/etc/nixos
283-
</code></pre>
284-
<p>This creates the necessary configuration files under <code>/mnt/etc/nixos/</code>, which
285-
you can then customize as needed and copy them to your local machine in order to
286-
include them in your flake.</p>
287270
<h3 id="3-configure-your-ssh-key"><a class="header" href="#3-configure-your-ssh-key">3. Configure your SSH key</a></h3>
288271
<p>If you cloned
289272
<a href="https://github.com/nix-community/nixos-anywhere-examples/blob/main/configuration.nix">our nixos-anywhere-example</a>
@@ -322,6 +305,10 @@ <h3 id="6-connectivity-to-the-target-machine"><a class="header" href="#6-connect
322305
SSH password prompts, set the <code>SSHPASS</code> environment variable to your password
323306
and add <code>--env-password</code> to the <code>nixos-anywhere</code> command.</p>
324307
<h3 id="7-optional-test-your-nixos-and-disko-configuration"><a class="header" href="#7-optional-test-your-nixos-and-disko-configuration">7. (Optional) Test your NixOS and Disko configuration</a></h3>
308+
<p>Skip this step and continue with Step 8, if you don't have a hardware
309+
configuration (hardware-configuration.nix or facter.json) generated yet or make
310+
sure you don't import non-existing hardware-configuration.nix or facter.json
311+
during running the vm test.</p>
325312
<p>The following command will automatically test your nixos configuration and run
326313
disko inside a virtual machine, where</p>
327314
<ul>
@@ -337,7 +324,58 @@ <h3 id="7-optional-test-your-nixos-and-disko-configuration"><a class="header" hr
337324
</ul>
338325
<pre><code>nix run github:nix-community/nixos-anywhere -- --flake &lt;path to configuration&gt;#&lt;configuration name&gt; --vm-test
339326
</code></pre>
340-
<h3 id="8-run-it"><a class="header" href="#8-run-it">8. Run it</a></h3>
327+
<h3 id="8-prepare-hardware-configuration"><a class="header" href="#8-prepare-hardware-configuration">8. Prepare Hardware Configuration</a></h3>
328+
<p>If you're not using a virtual machine, it's recommended to allow
329+
<code>nixos-anywhere</code> to generate a hardware configuration during installation. This
330+
ensures that essential drivers, such as those required for disk detection, are
331+
properly configured.</p>
332+
<p>To enable <code>nixos-anywhere</code> to integrate its generated configuration into your
333+
NixOS setup, you need to include an import for the hardware configuration
334+
beforehand.</p>
335+
<p>Here’s an example:</p>
336+
<pre><code class="language-diff"> nixosConfigurations.generic = nixpkgs.lib.nixosSystem {
337+
system = "x86_64-linux";
338+
modules = [
339+
disko.nixosModules.disko
340+
./configuration.nix
341+
+ ./hardware-configuration.nix
342+
];
343+
};
344+
</code></pre>
345+
<p>When running <code>nixos-anywhere</code>, this file is automatically generated by including
346+
the following flags in your command:
347+
<code>--generate-hardware-config nixos-generate-config ./hardware-configuration.nix</code>.
348+
The second flag, <code>./hardware-configuration.nix</code>, specifies where
349+
<code>nixos-generate-config</code> will store the configuration. Adjust this path to
350+
reflect the location where you want the <code>hardware-configuration.nix</code> for this
351+
machine to be saved.</p>
352+
<h4 id="81-nixos-facter"><a class="header" href="#81-nixos-facter">8.1 nixos-facter</a></h4>
353+
<p>As an alternative to <code>nixos-generate-config</code>, you can use the experimental
354+
<a href="https://github.com/numtide/nixos-facter">nixos-facter</a> command, which offers
355+
more comprehensive hardware reports and advanced configuration options.</p>
356+
<p>To use <code>nixos-facter</code>, add the following to your flake inputs:</p>
357+
<pre><code class="language-diff"> {
358+
+ inputs.nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
359+
}
360+
</code></pre>
361+
<p>Next, import the module into your configuration and specify <code>facter.json</code> as the
362+
path where the hardware report will be saved:</p>
363+
<pre><code class="language-diff"> nixosConfigurations.generic-nixos-facter = nixpkgs.lib.nixosSystem {
364+
system = "x86_64-linux";
365+
modules = [
366+
disko.nixosModules.disko
367+
./configuration.nix
368+
+ nixos-facter-modules.nixosModules.facter
369+
+ { config.facter.reportPath = ./facter.json }
370+
];
371+
};
372+
</code></pre>
373+
<p>To generate the configuration for <code>nixos-facter</code> with <code>nixos-anywhere</code>, use the
374+
following flags: <code>--generate-hardware-config nixos-facter ./facter.json</code>. The
375+
second flag, <code>./facter.json</code>, specifies where <code>nixos-generate-config</code> will store
376+
the hardware report. Adjust this path to suit the location where you want the
377+
<code>facter.json</code> to be saved.</p>
378+
<h3 id="9-run-it"><a class="header" href="#9-run-it">9. Run it</a></h3>
341379
<p>You can now run <strong>nixos-anywhere</strong> from the command line as shown below, where:</p>
342380
<ul>
343381
<li>
@@ -360,6 +398,15 @@ <h3 id="8-run-it"><a class="header" href="#8-run-it">8. Run it</a></h3>
360398
<code>37.27.18.135</code>:</p>
361399
<pre><code>nix run github:nix-community/nixos-anywhere -- --flake /home/mydir/test#hetzner-cloud root@37.27.18.135
362400
</code></pre>
401+
<p>If you also need to generate hardware configuration amend flags for
402+
nixos-generate-config:</p>
403+
<pre><code>nix run --generate-hardware-config nixos-generate-config ./hardware-configuration.nix github:nix-community/nixos-anywhere -- --flake &lt;path to configuration&gt;#&lt;configuration name&gt; root@&lt;ip address&gt;
404+
</code></pre>
405+
<p>Or these flags if you are using nixos-facter instead:</p>
406+
<pre><code>nix run --generate-hardware-config nixos-facter ./facter.json github:nix-community/nixos-anywhere -- --flake &lt;path to configuration&gt;#&lt;configuration name&gt; root@&lt;ip address&gt;
407+
</code></pre>
408+
<p>Adjust the location of <code>./hardware-configuration.nix</code> and <code>./facter.json</code>
409+
accordingly.</p>
363410
<p><strong>nixos-anywhere</strong> will then run, showing various output messages at each stage.
364411
It may take some time to complete, depending on Internet speeds. It should
365412
finish by showing the messages below before returning to the command prompt.</p>
@@ -775,12 +822,20 @@ <h2 id="command-line-usage"><a class="header" href="#command-line-usage">Command
775822
build the closure on the remote machine instead of locally and copy-closuring it
776823
* --vm-test
777824
build the system and test the disk configuration inside a VM without installing it to the target.
825+
* --generate-hardware-config nixos-facter|nixos-generate-config &lt;path&gt;
826+
generate a hardware-configuration.nix file using the specified backend and write it to the specified path.
827+
The backend can be either 'nixos-facter' or 'nixos-generate-config'.
778828
* --phases
779829
comma separated list of phases to run. Default is: kexec,disko,install,reboot
780830
kexec: kexec into the nixos installer
781831
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
782832
install: install the system
783833
reboot: reboot the machine
834+
* --disko-mode create|mount|disko
835+
set the disko mode to create, mount or destroy. Default is disko.
836+
format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
837+
mount: mount the partition at the specified root-mountpoint
838+
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
784839
</code></pre>
785840
<h2 id="explanation-of-known-error-messages"><a class="header" href="#explanation-of-known-error-messages">Explanation of known error messages</a></h2>
786841
<p>TODO: Add additional error messages and meanings. Fill in missing explanations</p>

quickstart.html

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -209,26 +209,9 @@ <h3 id="2-initialize-a-flake"><a class="header" href="#2-initialize-a-flake">2.
209209
into a new directory. This example is tailored for a virtual machine setup
210210
similar to one on <a href="https://www.hetzner.com/cloud">Hetzner Cloud</a>, so you might
211211
need to adapt it for your setup.</p>
212-
<p><strong>Hardware-Specific Configuration</strong>: If you're not using a virtual machine,
213-
you'll need to generate a custom hardware configuration with
214-
<code>nixos-generate-config</code>.</p>
215212
<p>If you already have a flake, you can use it by adding
216213
<a href="https://github.com/nix-community/disko?tab=readme-ov-file#how-to-use-disko">disko configuration</a>
217214
to it.</p>
218-
<h4 id="get-nixos-generate-config-onto-the-target-machine"><a class="header" href="#get-nixos-generate-config-onto-the-target-machine">Get <code>nixos-generate-config</code> onto the Target Machine</a></h4>
219-
<ol>
220-
<li><strong>Option 1</strong>: If NixOS is not installed, boot into an installer without first
221-
installing NixOS.</li>
222-
<li><strong>Option 2</strong>: Use the kexec tarball method, as described
223-
<a href="https://github.com/nix-community/nixos-images#kexec-tarballs">here</a>.</li>
224-
</ol>
225-
<h4 id="generate-configuration"><a class="header" href="#generate-configuration">Generate Configuration</a></h4>
226-
<p>Run the following command on the target machine:</p>
227-
<pre><code class="language-bash">nixos-generate-config --no-filesystems --dir /mnt/etc/nixos
228-
</code></pre>
229-
<p>This creates the necessary configuration files under <code>/mnt/etc/nixos/</code>, which
230-
you can then customize as needed and copy them to your local machine in order to
231-
include them in your flake.</p>
232215
<h3 id="3-configure-your-ssh-key"><a class="header" href="#3-configure-your-ssh-key">3. Configure your SSH key</a></h3>
233216
<p>If you cloned
234217
<a href="https://github.com/nix-community/nixos-anywhere-examples/blob/main/configuration.nix">our nixos-anywhere-example</a>
@@ -267,6 +250,10 @@ <h3 id="6-connectivity-to-the-target-machine"><a class="header" href="#6-connect
267250
SSH password prompts, set the <code>SSHPASS</code> environment variable to your password
268251
and add <code>--env-password</code> to the <code>nixos-anywhere</code> command.</p>
269252
<h3 id="7-optional-test-your-nixos-and-disko-configuration"><a class="header" href="#7-optional-test-your-nixos-and-disko-configuration">7. (Optional) Test your NixOS and Disko configuration</a></h3>
253+
<p>Skip this step and continue with Step 8, if you don't have a hardware
254+
configuration (hardware-configuration.nix or facter.json) generated yet or make
255+
sure you don't import non-existing hardware-configuration.nix or facter.json
256+
during running the vm test.</p>
270257
<p>The following command will automatically test your nixos configuration and run
271258
disko inside a virtual machine, where</p>
272259
<ul>
@@ -282,7 +269,58 @@ <h3 id="7-optional-test-your-nixos-and-disko-configuration"><a class="header" hr
282269
</ul>
283270
<pre><code>nix run github:nix-community/nixos-anywhere -- --flake &lt;path to configuration&gt;#&lt;configuration name&gt; --vm-test
284271
</code></pre>
285-
<h3 id="8-run-it"><a class="header" href="#8-run-it">8. Run it</a></h3>
272+
<h3 id="8-prepare-hardware-configuration"><a class="header" href="#8-prepare-hardware-configuration">8. Prepare Hardware Configuration</a></h3>
273+
<p>If you're not using a virtual machine, it's recommended to allow
274+
<code>nixos-anywhere</code> to generate a hardware configuration during installation. This
275+
ensures that essential drivers, such as those required for disk detection, are
276+
properly configured.</p>
277+
<p>To enable <code>nixos-anywhere</code> to integrate its generated configuration into your
278+
NixOS setup, you need to include an import for the hardware configuration
279+
beforehand.</p>
280+
<p>Here’s an example:</p>
281+
<pre><code class="language-diff"> nixosConfigurations.generic = nixpkgs.lib.nixosSystem {
282+
system = "x86_64-linux";
283+
modules = [
284+
disko.nixosModules.disko
285+
./configuration.nix
286+
+ ./hardware-configuration.nix
287+
];
288+
};
289+
</code></pre>
290+
<p>When running <code>nixos-anywhere</code>, this file is automatically generated by including
291+
the following flags in your command:
292+
<code>--generate-hardware-config nixos-generate-config ./hardware-configuration.nix</code>.
293+
The second flag, <code>./hardware-configuration.nix</code>, specifies where
294+
<code>nixos-generate-config</code> will store the configuration. Adjust this path to
295+
reflect the location where you want the <code>hardware-configuration.nix</code> for this
296+
machine to be saved.</p>
297+
<h4 id="81-nixos-facter"><a class="header" href="#81-nixos-facter">8.1 nixos-facter</a></h4>
298+
<p>As an alternative to <code>nixos-generate-config</code>, you can use the experimental
299+
<a href="https://github.com/numtide/nixos-facter">nixos-facter</a> command, which offers
300+
more comprehensive hardware reports and advanced configuration options.</p>
301+
<p>To use <code>nixos-facter</code>, add the following to your flake inputs:</p>
302+
<pre><code class="language-diff"> {
303+
+ inputs.nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
304+
}
305+
</code></pre>
306+
<p>Next, import the module into your configuration and specify <code>facter.json</code> as the
307+
path where the hardware report will be saved:</p>
308+
<pre><code class="language-diff"> nixosConfigurations.generic-nixos-facter = nixpkgs.lib.nixosSystem {
309+
system = "x86_64-linux";
310+
modules = [
311+
disko.nixosModules.disko
312+
./configuration.nix
313+
+ nixos-facter-modules.nixosModules.facter
314+
+ { config.facter.reportPath = ./facter.json }
315+
];
316+
};
317+
</code></pre>
318+
<p>To generate the configuration for <code>nixos-facter</code> with <code>nixos-anywhere</code>, use the
319+
following flags: <code>--generate-hardware-config nixos-facter ./facter.json</code>. The
320+
second flag, <code>./facter.json</code>, specifies where <code>nixos-generate-config</code> will store
321+
the hardware report. Adjust this path to suit the location where you want the
322+
<code>facter.json</code> to be saved.</p>
323+
<h3 id="9-run-it"><a class="header" href="#9-run-it">9. Run it</a></h3>
286324
<p>You can now run <strong>nixos-anywhere</strong> from the command line as shown below, where:</p>
287325
<ul>
288326
<li>
@@ -305,6 +343,15 @@ <h3 id="8-run-it"><a class="header" href="#8-run-it">8. Run it</a></h3>
305343
<code>37.27.18.135</code>:</p>
306344
<pre><code>nix run github:nix-community/nixos-anywhere -- --flake /home/mydir/test#hetzner-cloud root@37.27.18.135
307345
</code></pre>
346+
<p>If you also need to generate hardware configuration amend flags for
347+
nixos-generate-config:</p>
348+
<pre><code>nix run --generate-hardware-config nixos-generate-config ./hardware-configuration.nix github:nix-community/nixos-anywhere -- --flake &lt;path to configuration&gt;#&lt;configuration name&gt; root@&lt;ip address&gt;
349+
</code></pre>
350+
<p>Or these flags if you are using nixos-facter instead:</p>
351+
<pre><code>nix run --generate-hardware-config nixos-facter ./facter.json github:nix-community/nixos-anywhere -- --flake &lt;path to configuration&gt;#&lt;configuration name&gt; root@&lt;ip address&gt;
352+
</code></pre>
353+
<p>Adjust the location of <code>./hardware-configuration.nix</code> and <code>./facter.json</code>
354+
accordingly.</p>
308355
<p><strong>nixos-anywhere</strong> will then run, showing various output messages at each stage.
309356
It may take some time to complete, depending on Internet speeds. It should
310357
finish by showing the messages below before returning to the command prompt.</p>

reference.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,20 @@ <h2 id="command-line-usage"><a class="header" href="#command-line-usage">Command
229229
build the closure on the remote machine instead of locally and copy-closuring it
230230
* --vm-test
231231
build the system and test the disk configuration inside a VM without installing it to the target.
232+
* --generate-hardware-config nixos-facter|nixos-generate-config &lt;path&gt;
233+
generate a hardware-configuration.nix file using the specified backend and write it to the specified path.
234+
The backend can be either 'nixos-facter' or 'nixos-generate-config'.
232235
* --phases
233236
comma separated list of phases to run. Default is: kexec,disko,install,reboot
234237
kexec: kexec into the nixos installer
235238
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
236239
install: install the system
237240
reboot: reboot the machine
241+
* --disko-mode create|mount|disko
242+
set the disko mode to create, mount or destroy. Default is disko.
243+
format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
244+
mount: mount the partition at the specified root-mountpoint
245+
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
238246
</code></pre>
239247
<h2 id="explanation-of-known-error-messages"><a class="header" href="#explanation-of-known-error-messages">Explanation of known error messages</a></h2>
240248
<p>TODO: Add additional error messages and meanings. Fill in missing explanations</p>

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)