diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2024-04-29 12:45:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-29 12:45:18 +0200 |
commit | e1a4c08ae81a1e4c99b7496bd232cc4e47708957 (patch) | |
tree | ad30653e1113aff0cee78ddfb2584207081c13d5 /nixos/modules | |
parent | bb54a0c1977614ea64113f587396ecc55d0f0f4a (diff) | |
parent | a4a18f7b9263b56e3b7f7af51efc7a7585058ade (diff) |
Merge pull request #306339 from Mic92/systemd-boot
nixos/systemd-boot: avoid expensive mypy builds on configuration changes
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix index 8b218cf1a6b2f..02540c362d318 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix @@ -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 { |