enable prettier and reformat markdown

This commit is contained in:
Jörg Thalheim 2023-05-14 14:08:40 +02:00
parent 2ae380700c
commit f5646c99a0
5 changed files with 124 additions and 127 deletions

View File

@ -1,6 +1,6 @@
# nixos-anywhere # nixos-anywhere
***Install NixOS everywhere via ssh*** **_Install NixOS everywhere via ssh_**
![](https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png) ![](https://raw.githubusercontent.com/numtide/nixos-anywhere/main/docs/logo.png)
@ -27,7 +27,7 @@ You first create Nix configurations to specify partitioning, formatting and NixO
Once the configuration has been created, a single command will: Once the configuration has been created, a single command will:
- Connect to the remote server via SSH - Connect to the remote server via SSH
- Detect whether a NixOS installer is present; if not, it will use the Linux ```kexec``` tool to boot into a Nixos installer. - Detect whether a NixOS installer is present; if not, it will use the Linux `kexec` tool to boot into a Nixos installer.
- Use the [disko](https://github.com/nix-community/disko) tool to partition and format the hard drive - Use the [disko](https://github.com/nix-community/disko) tool to partition and format the hard drive
- Install NixOS - Install NixOS
- Optionally install any Nix packages and other software required. - Optionally install any Nix packages and other software required.
@ -40,14 +40,11 @@ It's also possible to use **nixos-anywhere** to simplify the installation on a m
## Prerequisites ## Prerequisites
- Source Machine: - Source Machine:
- - Can be any Linux machine with Nix installed, or a NixOS machine. - - Can be any Linux machine with Nix installed, or a NixOS machine.
- Target Machine: - Target Machine:
- Unless you're using the option to boot from a NixOS installer image, or providing your own ```kexec``` image, it must be running x86-64 Linux with kexec support. Most x86_64 Linux systems do have kexec support. By providing your own [image](./docs/how_to.md#using-your-own-kexec-image) you can also perform kexec for other architectures eg aarch64 - Unless you're using the option to boot from a NixOS installer image, or providing your own `kexec` image, it must be running x86-64 Linux with kexec support. Most x86_64 Linux systems do have kexec support. By providing your own [image](./docs/how_to.md#using-your-own-kexec-image) you can also perform kexec for other architectures eg aarch64
- Must have at least 1.5 GB of RAM, excluding swap. - Must have at least 1.5 GB of RAM, excluding swap.
## How to use nixos-anywhere ## How to use nixos-anywhere
@ -55,11 +52,11 @@ Heres  a quick summary of how to use **nixos-anywhere**. You can find more i
The tool doesn't need to be installed, since it can be run directly from this repository. The tool doesn't need to be installed, since it can be run directly from this repository.
First create a repo that includes the disk configuration and a [flake](https://nixos.wiki/wiki/Flakes) to configure your options. This example assumes that flakes have been enabled on your source machine. First create a repo that includes the disk configuration and a [flake](https://nixos.wiki/wiki/Flakes) to configure your options. This example assumes that flakes have been enabled on your source machine.
Heres an example of a simple disk configuration: Heres an example of a simple disk configuration:
``` ```nix
{ disks ? [ "/dev/vda" ], ... }: { disks ? [ "/dev/vda" ], ... }:
{ {
disk = { disk = {
@ -111,7 +108,7 @@ The [disko repository](https://github.com/nix-community/disko/tree/master/exampl
A simple flake may look like this: A simple flake may look like this:
``` ```nix
{ {
inputs.nixpkgs.url = github:NixOS/nixpkgs; inputs.nixpkgs.url = github:NixOS/nixpkgs;
inputs.disko.url = github:nix-community/disko; inputs.disko.url = github:nix-community/disko;
@ -178,7 +175,7 @@ If you would like to become a contributor, please see our [contribution guidelin
--- ---
This project is supported by [Numtide](https://numtide.com/).  ![Untitledpng](https://codahosted.io/docs/6FCIMTRM0p/blobs/bl-sgSunaXYWX/077f3f9d7d76d6a228a937afa0658292584dedb5b852a8ca370b6c61dabb7872b7f617e603f1793928dc5410c74b3e77af21a89e435fa71a681a868d21fd1f599dd10a647dd855e14043979f1df7956f67c3260c0442e24b34662307204b83ea34de929d)     This project is supported by [Numtide](https://numtide.com/).  ![Untitledpng](https://codahosted.io/docs/6FCIMTRM0p/blobs/bl-sgSunaXYWX/077f3f9d7d76d6a228a937afa0658292584dedb5b852a8ca370b6c61dabb7872b7f617e603f1793928dc5410c74b3e77af21a89e435fa71a681a868d21fd1f599dd10a647dd855e14043979f1df7956f67c3260c0442e24b34662307204b83ea34de929d)
We are a team of independent freelancers that love open source.  We help our customers make their project lifecycles more efficient by: We are a team of independent freelancers that love open source.  We help our customers make their project lifecycles more efficient by:

View File

@ -1,42 +1,40 @@
# How To Guide: nixos-anywhere # How To Guide: nixos-anywhere
## Contents ## Contents
[Installing on a machine with no operating system](#installing-on-a-machine-with-no-operating-system) [Installing on a machine with no operating system](#installing-on-a-machine-with-no-operating-system)
[Using your own kexec image](#using-your-own-kexec-image) [Using your own kexec image](#using-your-own-kexec-image)
[Using nixos-anywhere without flakes](#using-nixos-anywhere-without-flakes) [Using nixos-anywhere without flakes](#using-nixos-anywhere-without-flakes)
TODO: Add more topics TODO: Add more topics
## Installing on a machine with no operating system ## Installing on a machine with no operating system
TODO: Still to be documented TODO: Still to be documented
Include: Include:
`nixos-anywhere` can detect a nixos installer if it contains the identifier `VARIANT=installer` in its `/etc/os-release` file. This is the case for the nixos-unstable installer and will be also part of nixos 23.05. If an installer is detected `nixos-anywhere` will not try to kexec into its own image. `nixos-anywhere` can detect a nixos installer if it contains the identifier `VARIANT=installer` in its `/etc/os-release` file. This is the case for the nixos-unstable installer and will be also part of nixos 23.05. If an installer is detected `nixos-anywhere` will not try to kexec into its own image.
## Using your own kexec image ## Using your own kexec image
By default `nixos-anywhere` will download the kexec image from [here](https://github.com/nix-community/nixos-images#kexec-tarballs). It is also possible to provide your own by using the command line switch `--kexec` to specify the image file. The image will then be uploaded prior to executing. By default `nixos-anywhere` will download the kexec image from [here](https://github.com/nix-community/nixos-images#kexec-tarballs). It is also possible to provide your own by using the command line switch `--kexec` to specify the image file. The image will then be uploaded prior to executing.
``` ```
nixos-anywhere \ nixos-anywhere \
--kexec "$(nix build --print-out-paths github:nix-community/nixos-images#packages.x86_64-linux.kexec-installer-noninteractive-nixos-unstable)/nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz" \ --kexec "$(nix build --print-out-paths github:nix-community/nixos-images#packages.x86_64-linux.kexec-installer-noninteractive-nixos-unstable)/nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz" \
--flake 'github:your-user/your-repo#your-system' \ --flake 'github:your-user/your-repo#your-system' \
root@yourip root@yourip
``` ```
This is particularly useful for distributions like aarch64-linux, where there is no pre-build image. The following example assumes that your local machine can build for aarch64-linux either natively or through a remote builder This is particularly useful for distributions like aarch64-linux, where there is no pre-build image. The following example assumes that your local machine can build for aarch64-linux either natively or through a remote builder
## Using nixos-anywhere without flakes ## Using nixos-anywhere without flakes
TODO: Add content TODO: Add content
``` ```
``` ```

View File

@ -1,5 +1,5 @@
# Quickstart Guide: nixos-anywhere # Quickstart Guide: nixos-anywhere
This document describes how to use **nixos-anywhere** in its simplest case: installing NixOS on an existing Linux distribution via SSH. This document describes how to use **nixos-anywhere** in its simplest case: installing NixOS on an existing Linux distribution via SSH.
TODO: Populate this guide TODO: Populate this guide

View File

@ -1,69 +1,70 @@
# Reference Manual: nixos-anywhere # Reference Manual: nixos-anywhere
TODO: Populate this guide properly TODO: Populate this guide properly
## Contents ## Contents
[Command Line Usage](#command-line-usage) [Command Line Usage](#command-line-usage)
[Developer guide](#developer-guide) [Developer guide](#developer-guide)
[Explanation of known error messages](#explanation-of-known-error-messages) [Explanation of known error messages](#explanation-of-known-error-messages)
## Command Line Usage ## Command Line Usage
<!-- `$ bash ./src/nixos-anywhere.sh --help` --> <!-- `$ bash ./src/nixos-anywhere.sh --help` -->
```
Usage: nixos-anywhere [options] ssh-host ```
Usage: nixos-anywhere [options] ssh-host
Options:
Options:
* -f, --flake flake
set the flake to install the system from * -f, --flake flake
* -L, --print-build-logs set the flake to install the system from
print full build logs * -L, --print-build-logs
* -s, --store-paths print full build logs
set the store paths to the disko-script and nixos-system directly * -s, --store-paths
if this is give, flake is not needed set the store paths to the disko-script and nixos-system directly
* --no-reboot if this is give, flake is not needed
do not reboot after installation, allowing further customization of the target installation. * --no-reboot
* --kexec url do not reboot after installation, allowing further customization of the target installation.
use another kexec tarball to bootstrap NixOS * --kexec url
* --stop-after-disko use another kexec tarball to bootstrap NixOS
exit after disko formating, you can then proceed to install manually or some other way * --stop-after-disko
* --extra-files files exit after disko formating, you can then proceed to install manually or some other way
files to copy into the new nixos installation * --extra-files files
* --disk-encryption-keys remote_path local_path files to copy into the new nixos installation
copy the contents of the file or pipe in local_path to remote_path in the installer environment, * --disk-encryption-keys remote_path local_path
after kexec but before installation. Can be repeated. copy the contents of the file or pipe in local_path to remote_path in the installer environment,
* --no-substitute-on-destination after kexec but before installation. Can be repeated.
disable passing --substitute-on-destination to nix-copy * --no-substitute-on-destination
* --debug disable passing --substitute-on-destination to nix-copy
enable debug output * --debug
* --option KEY VALUE enable debug output
nix option to pass to every nix related command * --option KEY VALUE
* --from store-uri nix option to pass to every nix related command
URL of the source Nix store to copy the nixos and disko closure from * --from store-uri
* --build-on-remote URL of the source Nix store to copy the nixos and disko closure from
build the closure on the remote machine instead of locally and copy-closuring it * --build-on-remote
``` build the closure on the remote machine instead of locally and copy-closuring it
```
## Developer guide
## Developer guide
To run `nixos-anywhere` from the repo:
To run `nixos-anywhere` from the repo:
```shell
nix run . -- --help ```shell
``` nix run . -- --help
```
To format the code
To format the code
```shell
nix fmt ```shell
``` nix fmt
```
## Explanation of known error messages
## Explanation of known error messages
TODO: List actual error messages and meanings. Include:
TODO: List actual error messages and meanings. Include:
If you do not have enough RAM you will see failures unpacking the initrd), this is because kexec needs to load the whole nixos into memory.
If you do not have enough RAM you will see failures unpacking the initrd), this is because kexec needs to load the whole nixos into memory.

View File

@ -31,6 +31,7 @@
programs.nixpkgs-fmt.enable = true; programs.nixpkgs-fmt.enable = true;
programs.shellcheck.enable = true; programs.shellcheck.enable = true;
programs.shfmt.enable = true; programs.shfmt.enable = true;
programs.prettier.enable = true;
settings.formatter.shellcheck.options = [ "-s" "bash" ]; settings.formatter.shellcheck.options = [ "-s" "bash" ];
}; };
formatter = config.treefmt.build.wrapper; formatter = config.treefmt.build.wrapper;