about summary refs log tree commit diff
path: root/nixpkgs/nixos/maintainers/scripts/oci/create-image.sh
blob: 0d7332a0b272061070117efdb2f23a24b3625949 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env bash

set -euo pipefail

export NIX_PATH=nixpkgs=$(dirname $(readlink -f $0))/../../../..
export NIXOS_CONFIG=$(dirname $(readlink -f $0))/../../../modules/virtualisation/oci-image.nix

if (( $# < 1 )); then
    (
    echo "Usage: create-image.sh <architecture>"
    echo
    echo "Where <architecture> is one of:"
    echo "  x86_64-linux"
    echo "  aarch64-linux"
    ) >&2
fi

system="$1"; shift

nix-build '<nixpkgs/nixos>' \
    -A config.system.build.OCIImage \
    --argstr system "$system" \
    --option system-features kvm \
    -o oci-image