Make nix config accessible in scripts

This commit is contained in:
Manuel Thalmann 2024-07-28 12:16:01 +02:00
parent d9e32dd7cb
commit 40b0bafcac
2 changed files with 5 additions and 0 deletions

View file

@ -1,5 +1,6 @@
#!/bin/pwsh
$env:WIN_COMPUTER_NAME ??= "win11";
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";

View file

@ -3,6 +3,9 @@ $Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
$null = $env:WIN_COMPUTER_NAME;
$null = $env:SETUP_SCRIPT_NAME;
$null = $env:CONFIG_MODULE;
$config = ConvertFrom-Json (Get-Content "$env:CONFIG_MODULE.json");
[xml]$unattendedConfig = [xml]::new();
$unattendedConfig.PreserveWhitespace = $true;
@ -51,6 +54,7 @@ function Get-ScriptPathInjection($path) {
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = `
"powershell -Command " + `
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" + `
"`$env:CONFIG_MODULE = $(Get-ScriptPathInjection $env:CONFIG_MODULE);" + `
"Invoke-Expression $(Get-ScriptPathInjection "$PSScriptRoot/InitialBoot.ps1");";
$orderElement = $newCommand.SelectSingleNode("./ua:Order", $namespace);