Skip to content

Commit dc0e094

Browse files
nixos/installer: replace substituteAll with replaceVarsWith for tools
1 parent b9ea481 commit dc0e094

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

nixos/modules/installer/tools/tools.nix

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{ config, lib, pkgs, ... }:
55

66
let
7-
makeProg = args: pkgs.substituteAll (args // {
7+
makeProg = args: pkgs.replaceVarsWith (args // {
88
dir = "bin";
99
isExecutable = true;
1010
nativeBuildInputs = [
@@ -18,28 +18,32 @@ let
1818
nixos-generate-config = makeProg {
1919
name = "nixos-generate-config";
2020
src = ./nixos-generate-config.pl;
21-
perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
22-
hostPlatformSystem = pkgs.stdenv.hostPlatform.system;
23-
detectvirt = "${config.systemd.package}/bin/systemd-detect-virt";
24-
btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
25-
inherit (config.system.nixos-generate-config) configuration desktopConfiguration;
26-
xserverEnabled = config.services.xserver.enable;
21+
replacements = {
22+
perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
23+
hostPlatformSystem = pkgs.stdenv.hostPlatform.system;
24+
detectvirt = "${config.systemd.package}/bin/systemd-detect-virt";
25+
btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
26+
inherit (config.system.nixos-generate-config) configuration desktopConfiguration;
27+
xserverEnabled = config.services.xserver.enable;
28+
};
2729
manPage = ./manpages/nixos-generate-config.8;
2830
};
2931

3032
nixos-version = makeProg {
3133
name = "nixos-version";
3234
src = ./nixos-version.sh;
33-
inherit (pkgs) runtimeShell;
34-
inherit (config.system.nixos) version codeName revision;
35-
inherit (config.system) configurationRevision;
36-
json = builtins.toJSON ({
37-
nixosVersion = config.system.nixos.version;
38-
} // lib.optionalAttrs (config.system.nixos.revision != null) {
39-
nixpkgsRevision = config.system.nixos.revision;
40-
} // lib.optionalAttrs (config.system.configurationRevision != null) {
41-
configurationRevision = config.system.configurationRevision;
42-
});
35+
replacements = {
36+
inherit (pkgs) runtimeShell;
37+
inherit (config.system.nixos) version codeName revision;
38+
inherit (config.system) configurationRevision;
39+
json = builtins.toJSON ({
40+
nixosVersion = config.system.nixos.version;
41+
} // lib.optionalAttrs (config.system.nixos.revision != null) {
42+
nixpkgsRevision = config.system.nixos.revision;
43+
} // lib.optionalAttrs (config.system.configurationRevision != null) {
44+
configurationRevision = config.system.configurationRevision;
45+
});
46+
};
4347
manPage = ./manpages/nixos-version.8;
4448
};
4549

0 commit comments

Comments
 (0)