From 17ccb9d76a79ac691c1e598171af6ef7f7509a9c Mon Sep 17 00:00:00 2001
From: Scott Worley <scottworley@scottworley.com>
Date: Mon, 23 Aug 2021 13:17:45 -0700
Subject: [PATCH] Help get-version-suffix find itself

get-version-suffix assumes that nixpkgs is always installed at <nixpkgs>.
This is not true when using a nixpkgs wrapper, such as this warn-nixpkgs.
---
 nixos/modules/installer/tools/get-version-suffix | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/installer/tools/get-version-suffix b/nixos/modules/installer/tools/get-version-suffix
index fceb513..9b73e1e 100755
--- a/nixos/modules/installer/tools/get-version-suffix
+++ b/nixos/modules/installer/tools/get-version-suffix
@@ -1,5 +1,7 @@
 #!/bin/sh
 
-echo "warning: Using legacy channel get-version-suffix from `nix-instantiate --find-file nixpkgs-warned "$@"`/nixos/modules/installer/tools/get-version-suffix" >&2
+warn_nixpkgs_actual_nixpkgs_path="`nix-instantiate --find-file nixpkgs-warned "$@"`"
 
-/bin/sh `nix-instantiate --find-file nixpkgs-warned "$@"`/nixos/modules/installer/tools/get-version-suffix "$@"
+echo "warning: Using legacy channel get-version-suffix from $warn_nixpkgs_actual_nixpkgs_path/nixos/modules/installer/tools/get-version-suffix" >&2
+
+/bin/sh "$warn_nixpkgs_actual_nixpkgs_path/nixos/modules/installer/tools/get-version-suffix" -I nixpkgs="$warn_nixpkgs_actual_nixpkgs_path" "$@"
-- 
2.47.2