tool: clean up a few minor details

This commit is contained in:
nikstur 2023-09-14 16:18:58 +02:00
parent 3bf55f92b8
commit 0b5ce324d7
3 changed files with 12 additions and 7 deletions

View File

@ -103,8 +103,10 @@ in
${sbctlWithPki}/bin/sbctl enroll-keys --yes-this-might-brick-my-machine ${sbctlWithPki}/bin/sbctl enroll-keys --yes-this-might-brick-my-machine
''} ''}
# Use the system from the kernel's hostPlatform because this should
# always, even in the cross compilation case, be the right system.
${cfg.package}/bin/lzbt install \ ${cfg.package}/bin/lzbt install \
--system ${config.nixpkgs.hostPlatform.system or config.boot.kernelPackages.stdenv.hostPlatform.system} \ --system ${config.boot.kernelPackages.stdenv.hostPlatform.system} \
--systemd ${config.systemd.package} \ --systemd ${config.systemd.package} \
--systemd-boot-loader-config ${loaderConfigFile} \ --systemd-boot-loader-config ${loaderConfigFile} \
--public-key ${cfg.publicKeyFile} \ --public-key ${cfg.publicKeyFile} \

View File

@ -29,7 +29,7 @@ impl Architecture {
Ok(match system_double { Ok(match system_double {
"x86_64-linux" => Self::X86, "x86_64-linux" => Self::X86,
"aarch64-linux" => Self::AArch64, "aarch64-linux" => Self::AArch64,
_ => bail!("Unsupported NixOS system double: {}, please open an issue or a PR if you think this should be supported.", system_double) _ => bail!(format!("Unsupported NixOS system: {}.", system_double)),
}) })
} }
} }

View File

@ -3,7 +3,8 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use anyhow::{Context, Result}; use anyhow::{bail, Context, Result};
use indoc::indoc;
use crate::architecture::Architecture; use crate::architecture::Architecture;
use crate::generation::Generation; use crate::generation::Generation;
@ -39,10 +40,12 @@ impl EspGenerationPaths {
let bootspec = &generation.spec.bootspec.bootspec; let bootspec = &generation.spec.bootspec.bootspec;
let bootspec_system: Architecture = Architecture::from_nixos_system(&bootspec.system)?; let bootspec_system: Architecture = Architecture::from_nixos_system(&bootspec.system)?;
assert_eq!( if system != bootspec_system {
system, bootspec_system, bail!(indoc! {r#"
"Bootspec's system differs from provided target system, unsupported usecase!" The CPU architecture declared in your module differs from the one declared in the
); bootspec of the current generation.
"#})
}
Ok(Self { Ok(Self {
kernel: esp_paths kernel: esp_paths