build images from flake

This commit is contained in:
Jörg Thalheim 2022-12-16 15:27:57 +01:00
parent 44f92f57b5
commit ef2c00e699
3 changed files with 9 additions and 16 deletions

View file

@ -6,12 +6,6 @@ on:
- cron: '51 2 * * 0' - cron: '51 2 * * 0'
jobs: jobs:
images: images:
strategy:
fail-fast: false
matrix:
tag:
- nixos-22.11
- nixos-unstable
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -19,6 +13,6 @@ jobs:
with: with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz
- name: Build image - name: Build image
run: ./build-images.sh "${{matrix.tag}}" run: ./build-images.sh
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,12 +1,12 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -p nixos-generators -p nix -p coreutils -p bash -p gh -i bash #!nix-shell -p nix -p coreutils -p bash -p gh -i bash
# shellcheck shell=bash # shellcheck shell=bash
set -xeuo pipefail set -xeuo pipefail
shopt -s lastpipe shopt -s lastpipe
build_netboot_image() { build_netboot_image() {
declare -r tag=$1 arch=$2 tmp=$3 declare -r tag=$1 arch=$2 tmp=$3
img=$(nix-build --no-out-link -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" '<nixpkgs/nixos/release.nix>' -A "netboot.$arch") img=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.netboot-${tag//.}")
ln -s "$img/bzImage" "$tmp/bzImage-$arch" ln -s "$img/bzImage" "$tmp/bzImage-$arch"
echo "$tmp/bzImage-$arch" echo "$tmp/bzImage-$arch"
ln -s "$img/initrd" "$tmp/initrd-$arch" ln -s "$img/initrd" "$tmp/initrd-$arch"
@ -19,12 +19,9 @@ build_netboot_image() {
echo "$tmp/netboot-$arch.ipxe" echo "$tmp/netboot-$arch.ipxe"
} }
build_kexec_installer() { build_kexec_installer() {
declare -r tag=$1 arch=$2 tmp=$3 declare -r tag=$1 arch=$2 tmp=$3
# run the test once we have kvm support in github actions out=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.kexec-installer-${tag//.}")
# ignore=$(nix-build ./nix/kexec-installer/test.nix -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" --argstr system "$arch")
out=$(nix-build '<nixpkgs/nixos>' -o "$tmp/kexec-installer-$arch" -I nixos-config=./nix/kexec-installer/module.nix -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" --argstr system "$arch" -A config.system.build.kexecTarball)
echo "$out/nixos-kexec-installer-$arch.tar.gz" echo "$out/nixos-kexec-installer-$arch.tar.gz"
} }
@ -34,7 +31,6 @@ main() {
trap 'rm -rf -- "$tmp"' EXIT trap 'rm -rf -- "$tmp"' EXIT
( (
build_kexec_installer "$tag" "$arch" "$tmp" build_kexec_installer "$tag" "$arch" "$tmp"
build_kexec_bundle "$tag" "$arch" "$tmp"
build_netboot_image "$tag" "$arch" "$tmp" build_netboot_image "$tag" "$arch" "$tmp"
) | readarray -t assets ) | readarray -t assets
for asset in "${assets[@]}"; do for asset in "${assets[@]}"; do

View file

@ -14,9 +14,12 @@
outputs = { self, nixos-unstable, nixos-2211 }: { outputs = { self, nixos-unstable, nixos-2211 }: {
packages.x86_64-linux = let packages.x86_64-linux = let
netboot = nixpkgs: (import (nixpkgs + "/nixos/release.nix") {}).netboot.x86_64-linux; netboot = nixpkgs: (import (nixpkgs + "/nixos/release.nix") {}).netboot.x86_64-linux;
kexec-installer = nixpkgs: (nixpkgs.legacyPackages.x86_64-linux.nixos [self.nixosModules.kexec-installer]).config.system.build.kexecTarball;
in { in {
netboot-unstable = netboot nixos-unstable; netboot-nixos-unstable = netboot nixos-unstable;
netboot-2211 = netboot nixos-2211; netboot-nixos-nixos-2211 = netboot nixos-2211;
kexec-installer-nixos-unstable = kexec-installer nixos-unstable;
kexec-installer-nixos-2211 = kexec-installer nixos-2211;
}; };
nixosModules.kexec-installer = import ./nix/kexec-installer/module.nix; nixosModules.kexec-installer = import ./nix/kexec-installer/module.nix;
checks.x86_64-linux = { checks.x86_64-linux = {