-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathdocker-compose.yml
36 lines (33 loc) · 1.68 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Compose file which provides automagic building of NixOS SD images for AArch64 systems.
# Use together with `docker-compose.emulation.yml` if a transparent emulation layer is required.
# Comes out with sane defaults, feel free to configure as needed.
# NOTE: the configuration used to build NixOS resides in the parent directory as `sd-image.nix`
version: "3"
services:
# Main container, requires no elevated privileges to run. Builds NixOS.
build-nixos:
build:
context: build-nixos
args:
IMAGE_BASE: $IMAGE_BASE
NIXPKGS_URL: "https://github.com/nixos/nixpkgs"
NIXPKGS_BRANCH: "nixos-23.11"
working_dir: /home/nixos
# Main command line, left here so it can be changed easily. The container will:
# - setup the environment. This includes adding the Nix executables to $PATH, along with the
# registration of an EXIT handler which will send a signal to `cleanup-qemu` when done.
# - wait until `setup-qemu` is done by attempting to run an AArch64 binary. This works out of
# the box if running on AArch64.
# - build the actual SD image.
# - copy it to /build, which points by default to this directory.
command: [sh, -c, ". setup-env && \
sh wait-for-qemu.sh && \
nix-build \
-A config.system.build.sdImage \
--option system aarch64-linux \
--option sandbox false \
-I nixos-config=/build/config/sd-image.nix \
nixpkgs/nixos/default.nix && \
chmod u+w result/sd-image/* && sudo cp result/sd-image/* /build"]
volumes:
- ..:/build