nixos-generators/README.md

91 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

# nixos-generators - one config, multiple formats
The nixos-generators project allows to take the same NixOS configuration, and
generate outputs for different target formats.
Just put your stuff into the configuration.nix and then call one of the image builders.
2018-04-28 13:01:45 +03:00
for example:
```
nixos-generate -f iso
2018-04-28 13:01:45 +03:00
```
2018-05-17 23:46:25 +03:00
or
2018-05-17 23:46:25 +03:00
```
nixos-generate -f iso -c /etc/nixos/configuration.nix
2018-05-17 23:46:25 +03:00
```
2018-04-28 13:01:45 +03:00
it echoes the path to a iso image, which you then can flash onto an usb-stick
or mount & boot in a virtual machine.
2018-04-28 13:01:45 +03:00
2019-01-22 01:47:08 +03:00
# Installation
nixos-generators can be installed from source into the user profile like this:
```console
nix-env -f https://github.com/nix-community/nixos-generators/archive/master.tar.gz -i
2019-01-22 01:47:08 +03:00
```
## Supported formats
2018-04-28 13:01:45 +03:00
format | description
--- | ---
azure | Microsoft azure image (Generation 1 / VHD)
2019-12-01 20:25:19 +03:00
do | Digital Ocean image
gce | Google Compute image
hyperv | Hyper-V Image (Generation 2 / VHDX)
2019-01-19 00:17:38 +03:00
install-iso | Installer ISO
2019-12-01 22:10:37 +03:00
install-iso-hyperv | Installer ISO with enabled hyper-v support
2019-01-19 00:17:38 +03:00
iso | ISO
2019-01-20 23:32:05 +03:00
kexec | kexec tarball (extract to / and run /kexec_nixos)
kexec-bundle | same as before, but it's just an executable
2019-02-07 19:59:08 +03:00
lxc | create a tarball which is importable as an lxc container, use together with lxc-metadata
lxc-metadata | the necessary metadata for the lxc image to start, usage: lxc image import $(nixos-generate -f lxc-metadata) $(nixos-generate -f lxc)
2019-01-20 23:32:05 +03:00
openstack | qcow2 image for openstack
2019-04-26 10:27:07 +03:00
cloudstack | qcow2 image for cloudstack
qcow | qcow2 image
2020-05-11 11:02:39 +03:00
raw | raw image with bios/mbr
2020-05-10 20:32:33 +03:00
raw-efi | raw image with efi support
2019-01-20 23:32:05 +03:00
virtualbox | virtualbox VM
vm | only used as a qemu-kvm runner
vm-nogui | same as before, but without a GUI
2019-04-11 09:12:13 +03:00
sd-aarch64-installer | create an installer sd card for aarch64. For cross compiling use `--system aarch64-linux` and read the cross-compile section.
sd-aarch64 | Like sd-aarch64-installer, but does not use default installer image config.
2018-05-11 13:01:00 +03:00
## Usage
2018-05-11 13:01:00 +03:00
Run `nixos-generate --help` for detailed usage information.
2019-01-17 19:38:32 +03:00
2019-12-02 13:27:25 +03:00
## select a specific nixpkgs channel
adds ability to select a specific channel version.
example:
```
nix-shell --command './nixos-generate -f iso -I nixpkgs=channel:nixos-19.09'
```
2019-12-01 20:25:19 +03:00
## Using a particular nixpkgs
To use features found in a different nixpkgs (for instance the Digital Ocean
image was recently merged in nixpkgs):
```
NIX_PATH=nixpkgs=../nixpkgs nixos-generate -f do
```
2019-03-22 17:35:50 +03:00
## Cross Compiling
To cross compile nixos images for other system you have
to configure `boot.binfmtMiscRegistrations` on your host system.
For more details about this have a look at :
[clevers qemu-user](https://github.com/cleverca22/nixos-configs/blob/master/qemu.nix).
Once you've run `nixos-rebuild` with theses options,
you can use the `--system` option to create images for other architectures.
2019-01-17 19:38:32 +03:00
### License
This project is licensed under the [MIT License](LICENSE).