Merge pull request #40 from nix-community/ci

Ci
This commit is contained in:
Jörg Thalheim 2022-12-16 14:31:45 +00:00 committed by GitHub
commit 7d284f5b93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 32 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

@ -19,11 +19,6 @@ count) in the system. If not enough RAM is available, the initrd cannot be
loaded. Because the NixOS runs only in RAM, users can reformat all the system's loaded. Because the NixOS runs only in RAM, users can reformat all the system's
discs to prepare for a new NixOS installation. discs to prepare for a new NixOS installation.
Currently, there are two variants of kexec: [nixos-kexec-installer](https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-x86_64-linux.tar.xz)
and [kexec bundle](https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/kexec-bundle-x86_64-linux).
The nixos-kexec-installer tarball is the new preferred method.
It can be booted as follows by running these commands as root: It can be booted as follows by running these commands as root:
``` ```
@ -44,7 +39,3 @@ The actual kexec happens with a slight delay (6s). This allows for easier
integration into automated nixos installation scripts, since you can cleanly integration into automated nixos installation scripts, since you can cleanly
disconnect from the running machine before the kexec takes place. The tarball disconnect from the running machine before the kexec takes place. The tarball
is also designed to be run from NixOS, which can be useful for new installations is also designed to be run from NixOS, which can be useful for new installations
We also have [kexec-bundle](https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/kexec-bundle-x86_64-linux),
which is a self-extracting archive from [nixos-generators](https://github.com/nix-community/nixos-generators).
This version unpacks itself to `/` and possibly overlays the existing `/nix/store` with its own files.

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,19 +19,9 @@ build_netboot_image() {
echo "$tmp/netboot-$arch.ipxe" echo "$tmp/netboot-$arch.ipxe"
} }
build_kexec_bundle() {
declare -r tag=$1 arch=$2 tmp=$3
# the default configuration conflicts with the kexec bundle configuration
echo "{}" > "$tmp/config.nix"
nixos-generate -o "$tmp/kexec-bundle-$arch" -c "$tmp/config.nix" -f kexec-bundle -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" >/dev/null
echo "$tmp/kexec-bundle-$arch"
}
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"
} }
@ -41,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 = {