From dc0e094b331a3a5cbdef44e5ea7a2b718e9f8680 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 28 Jan 2025 20:49:08 +0100 Subject: [PATCH] nixos/installer: replace substituteAll with replaceVarsWith for tools --- nixos/modules/installer/tools/tools.nix | 38 ++++++++++++++----------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index e4d03f39018e..3731b011a845 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -4,7 +4,7 @@ { config, lib, pkgs, ... }: let - makeProg = args: pkgs.substituteAll (args // { + makeProg = args: pkgs.replaceVarsWith (args // { dir = "bin"; isExecutable = true; nativeBuildInputs = [ @@ -18,28 +18,32 @@ let nixos-generate-config = makeProg { name = "nixos-generate-config"; src = ./nixos-generate-config.pl; - 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; + 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; - inherit (pkgs) runtimeShell; - inherit (config.system.nixos) version codeName revision; - inherit (config.system) configurationRevision; - json = builtins.toJSON ({ - nixosVersion = config.system.nixos.version; - } // lib.optionalAttrs (config.system.nixos.revision != null) { - nixpkgsRevision = config.system.nixos.revision; - } // lib.optionalAttrs (config.system.configurationRevision != null) { - configurationRevision = config.system.configurationRevision; - }); + replacements = { + inherit (pkgs) runtimeShell; + inherit (config.system.nixos) version codeName revision; + inherit (config.system) configurationRevision; + json = builtins.toJSON ({ + nixosVersion = config.system.nixos.version; + } // lib.optionalAttrs (config.system.nixos.revision != null) { + nixpkgsRevision = config.system.nixos.revision; + } // lib.optionalAttrs (config.system.configurationRevision != null) { + configurationRevision = config.system.configurationRevision; + }); + }; manPage = ./manpages/nixos-version.8; };