Unverified Commit e1a4c08a authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

Merge pull request #306339 from Mic92/systemd-boot

nixos/systemd-boot: avoid expensive mypy builds on configuration changes
parents bb54a0c1 a4a18f7b
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -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 {