commit
7d284f5b93
4 changed files with 9 additions and 32 deletions
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
|
@ -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 }}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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" '<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"
|
||||
echo "$tmp/bzImage-$arch"
|
||||
ln -s "$img/initrd" "$tmp/initrd-$arch"
|
||||
|
@ -19,19 +19,9 @@ 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
|
||||
# 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 '<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)
|
||||
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"
|
||||
}
|
||||
|
||||
|
@ -41,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
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue