From b779b46dd2f032c70aa2cb72a88f597d6c0f0cff Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 26 Apr 2022 12:12:01 +0200 Subject: [PATCH] lxd: fix nixos tests on aarch64 Tested on a RPi3 B+ with a 2g swapfile. On that system the test still sometimes fails, but I suspect this is because it is really just not powerful enough for this task. Fixes #170395 --- nixos/tests/lxd.nix | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/nixos/tests/lxd.nix b/nixos/tests/lxd.nix index 81b36124cc6b..162bbcc47e87 100644 --- a/nixos/tests/lxd.nix +++ b/nixos/tests/lxd.nix @@ -6,16 +6,47 @@ let # # I've chosen to import Alpine Linux, because its image is turbo-tiny and, # generally, sufficient for our tests. - alpine-meta = pkgs.fetchurl { + alpine-meta-x86 = pkgs.fetchurl { url = "https://tarballs.nixos.org/alpine/3.12/lxd.tar.xz"; hash = "sha256-1tcKaO9lOkvqfmG/7FMbfAEToAuFy2YMewS8ysBKuLA="; }; + alpine-meta-for = arch: pkgs.stdenv.mkDerivation { + name = "alpine-meta-${arch}"; + version = "3.12"; + unpackPhase = "true"; + buildPhase = '' + runHook preBuild - alpine-rootfs = pkgs.fetchurl { - url = "https://tarballs.nixos.org/alpine/3.12/rootfs.tar.xz"; - hash = "sha256-Tba9sSoaiMtQLY45u7p5DMqXTSDgs/763L/SQp0bkCA="; + tar xvf ${alpine-meta-x86} + sed -i 's/architecture: .*/architecture: ${arch}/' metadata.yaml + + runHook postBuild + ''; + installPhase = '' + runHook preInstall + + tar czRf $out * + + runHook postInstall + ''; }; + alpine-meta = { + x86_64-linux = alpine-meta-x86; + aarch64-linux = alpine-meta-for "aarch64"; + }.${pkgs.system} or (throw "Unsupported system: ${pkgs.system}"); + + alpine-rootfs = { + x86_64-linux = pkgs.fetchurl { + url = "https://tarballs.nixos.org/alpine/3.12/rootfs.tar.xz"; + hash = "sha256-Tba9sSoaiMtQLY45u7p5DMqXTSDgs/763L/SQp0bkCA="; + }; + aarch64-linux = pkgs.fetchurl { + url = "https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/aarch64/alpine-minirootfs-3.15.4-aarch64.tar.gz"; + hash = "sha256-9kBz8Jwmo8XepJhTMt5zilCaHHpflnUH7y9+0To39Us="; + }; + }.${pkgs.system} or (throw "Unsupported system: ${pkgs.system}"); + lxd-config = pkgs.writeText "config.yaml" '' storage_pools: - name: default