From 44f92f57b505188db539b384b389f72612a82b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 16 Dec 2022 15:27:15 +0100 Subject: [PATCH 1/2] drop kexec-bundle kexec-installer is better tested and smaller at this point. --- README.md | 9 --------- build-images.sh | 7 ------- 2 files changed, 16 deletions(-) diff --git a/README.md b/README.md index 7acb3e5..de900af 100644 --- a/README.md +++ b/README.md @@ -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 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: ``` @@ -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 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 - -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. diff --git a/build-images.sh b/build-images.sh index 5bc47c5..028c362 100755 --- a/build-images.sh +++ b/build-images.sh @@ -19,13 +19,6 @@ build_netboot_image() { 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() { declare -r tag=$1 arch=$2 tmp=$3 From ef2c00e6993b046727db03a547f1e7423a83b379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 16 Dec 2022 15:27:57 +0100 Subject: [PATCH 2/2] build images from flake --- .github/workflows/build.yml | 8 +------- build-images.sh | 10 +++------- flake.nix | 7 +++++-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f565e7b..a4fd236 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,12 +6,6 @@ on: - cron: '51 2 * * 0' jobs: images: - strategy: - fail-fast: false - matrix: - tag: - - nixos-22.11 - - nixos-unstable runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -19,6 +13,6 @@ jobs: with: nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz - name: Build image - run: ./build-images.sh "${{matrix.tag}}" + run: ./build-images.sh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build-images.sh b/build-images.sh index 028c362..b80ec9c 100755 --- a/build-images.sh +++ b/build-images.sh @@ -1,12 +1,12 @@ #!/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 set -xeuo pipefail shopt -s lastpipe build_netboot_image() { 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" '' -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" echo "$tmp/bzImage-$arch" ln -s "$img/initrd" "$tmp/initrd-$arch" @@ -19,12 +19,9 @@ build_netboot_image() { echo "$tmp/netboot-$arch.ipxe" } - build_kexec_installer() { declare -r tag=$1 arch=$2 tmp=$3 - # run the test once we have kvm support in github actions - # 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 '' -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) + out=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.kexec-installer-${tag//.}") echo "$out/nixos-kexec-installer-$arch.tar.gz" } @@ -34,7 +31,6 @@ main() { trap 'rm -rf -- "$tmp"' EXIT ( build_kexec_installer "$tag" "$arch" "$tmp" - build_kexec_bundle "$tag" "$arch" "$tmp" build_netboot_image "$tag" "$arch" "$tmp" ) | readarray -t assets for asset in "${assets[@]}"; do diff --git a/flake.nix b/flake.nix index 72e1dec..fe86fd9 100644 --- a/flake.nix +++ b/flake.nix @@ -14,9 +14,12 @@ outputs = { self, nixos-unstable, nixos-2211 }: { packages.x86_64-linux = let 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 { - netboot-unstable = netboot nixos-unstable; - netboot-2211 = netboot nixos-2211; + netboot-nixos-unstable = netboot nixos-unstable; + 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; checks.x86_64-linux = {