Unverified Commit 7966716b authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

nixos/{systemd-boot,installer}: replace `substituteAll` with `replaceVarsWith` (#377620)

parents 024545f5 dc0e094b
Loading
Loading
Loading
Loading
+21 −17
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
{ config, lib, pkgs, ... }:

let
  makeProg = args: pkgs.substituteAll (args // {
  makeProg = args: pkgs.replaceVarsWith (args // {
    dir = "bin";
    isExecutable = true;
    nativeBuildInputs = [
@@ -18,18 +18,21 @@ let
  nixos-generate-config = makeProg {
    name = "nixos-generate-config";
    src = ./nixos-generate-config.pl;
    replacements = {
      perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
      hostPlatformSystem = pkgs.stdenv.hostPlatform.system;
      detectvirt = "${config.systemd.package}/bin/systemd-detect-virt";
      btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
      inherit (config.system.nixos-generate-config) configuration desktopConfiguration;
      xserverEnabled = config.services.xserver.enable;
    };
    manPage = ./manpages/nixos-generate-config.8;
  };

  nixos-version = makeProg {
    name = "nixos-version";
    src = ./nixos-version.sh;
    replacements = {
      inherit (pkgs) runtimeShell;
      inherit (config.system.nixos) version codeName revision;
      inherit (config.system) configurationRevision;
@@ -40,6 +43,7 @@ let
      } // lib.optionalAttrs (config.system.configurationRevision != null) {
        configurationRevision = config.system.configurationRevision;
      });
    };
    manPage = ./manpages/nixos-version.8;
  };

+48 −50
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ let

  edk2ShellEspPath = "efi/edk2-uefi-shell/shell.efi";

  systemdBootBuilder = pkgs.substituteAll rec {
  systemdBootBuilder = pkgs.replaceVarsWith {
    name = "systemd-boot";

    dir = "bin";
@@ -40,6 +40,7 @@ let

    isExecutable = true;

    replacements = rec {
      inherit (builtins) storeDir;

      inherit (pkgs) python3;
@@ -70,10 +71,6 @@ let

      inherit (config.system.nixos) distroName;

    memtest86 = optionalString cfg.memtest86.enable pkgs.memtest86plus;

    netbootxyz = optionalString cfg.netbootxyz.enable pkgs.netbootxyz-efi;

      checkMountpoints = pkgs.writeShellScript "check-mountpoints" ''
        fail() {
          echo "$1 = '$2' is not a mounted partition. Is the path configured correctly?" >&2
@@ -103,6 +100,7 @@ let
        )}
      '';
    };
  };

  finalSystemdBootBuilder = pkgs.writeScript "install-systemd-boot.sh" ''
    #!${pkgs.runtimeShell}