Merge pull request #306339 from Mic92/systemd-boot

nixos/systemd-boot: avoid expensive mypy builds on configuration changes
This commit is contained in:
Jörg Thalheim 2024-04-29 12:45:18 +02:00 committed by GitHub
commit e1a4c08ae8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 12 deletions

View File

@ -7,8 +7,20 @@ let
efi = config.boot.loader.efi;
# We check the source code in a derivation that does not depend on the
# system configuration so that most users don't have to redo the check and require
# the necessary dependencies.
checkedSource = pkgs.runCommand "systemd-boot" { } ''
install -m755 -D ${./systemd-boot-builder.py} $out
${lib.getExe pkgs.buildPackages.mypy} \
--no-implicit-optional \
--disallow-untyped-calls \
--disallow-untyped-defs \
$out
'';
systemdBootBuilder = pkgs.substituteAll rec {
src = ./systemd-boot-builder.py;
src = checkedSource;
isExecutable = true;
@ -66,19 +78,9 @@ let
'';
};
checkedSystemdBootBuilder = pkgs.runCommand "systemd-boot" { } ''
mkdir -p $out/bin
install -m755 ${systemdBootBuilder} $out/bin/systemd-boot-builder
${lib.getExe pkgs.buildPackages.mypy} \
--no-implicit-optional \
--disallow-untyped-calls \
--disallow-untyped-defs \
$out/bin/systemd-boot-builder
'';
finalSystemdBootBuilder = pkgs.writeScript "install-systemd-boot.sh" ''
#!${pkgs.runtimeShell}
${checkedSystemdBootBuilder}/bin/systemd-boot-builder "$@"
${systemdBootBuilder} "$@"
${cfg.extraInstallCommands}
'';
in {