Cache flake on Windows
This commit is contained in:
parent
26592d589c
commit
42322c7428
|
@ -76,17 +76,22 @@ $null = New-Module {
|
|||
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
|
||||
fish -c ". $escapedPath; $Script";
|
||||
} else {
|
||||
$cleanup = { };
|
||||
$projectRoot = "$PSScriptRoot/../../..";
|
||||
$archisoDir = "$projectRoot/archiso";
|
||||
if (-not $env:VALHALLA_FLAKE_ROOT) {
|
||||
$cleanup = { };
|
||||
$projectRoot = "$PSScriptRoot/../../..";
|
||||
$archisoDir = "$projectRoot/archiso";
|
||||
|
||||
if (Test-Path -PathType Container "$archisoDir") {
|
||||
$git = {
|
||||
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
|
||||
};
|
||||
if (Test-Path -PathType Container "$archisoDir") {
|
||||
$git = {
|
||||
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
|
||||
};
|
||||
|
||||
& $git rm -r --cached "$archisoDir" *> $null;
|
||||
$cleanup = { & $git restore --staged "$archisoDir" };
|
||||
& $git rm -r --cached "$archisoDir" *> $null;
|
||||
$cleanup = { & $git restore --staged "$archisoDir" };
|
||||
}
|
||||
|
||||
$env:VALHALLA_FLAKE_ROOT = (Invoke-Nix flake metadata (ConvertTo-LinuxPath "$PSScriptRoot/../../..") --json | ConvertFrom-Json).path;
|
||||
& $cleanup *> $null;
|
||||
}
|
||||
|
||||
$output = Invoke-Fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script";
|
||||
|
@ -96,8 +101,6 @@ $null = New-Module {
|
|||
} else {
|
||||
$output;
|
||||
}
|
||||
|
||||
& $cleanup *> $null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ $null = New-Module {
|
|||
$Global:ErrorActionPreference = $NonInteractive.IsPresent ? 'Continue' : 'Inquire';
|
||||
|
||||
if ($IsWindows) {
|
||||
$env:WSLENV = "CONFIG_NAME";
|
||||
$env:WSLENV = "CONFIG_NAME:VALHALLA_FLAKE_ROOT";
|
||||
Backup-PowerScheme;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/env fish
|
||||
function evalFlake --argument-names config property
|
||||
set -l argv $argv[3..]
|
||||
set -l flakePath "$(realpath (status dirname))/../../..";
|
||||
argparse --ignore-unknown "apply=" "json" -- $argv
|
||||
|
||||
if [ -z "$_flag_json" ]
|
||||
|
@ -13,6 +14,10 @@ function evalFlake --argument-names config property
|
|||
set _flag_apply "_: _"
|
||||
end
|
||||
|
||||
if [ -n "$VALHALLA_FLAKE_ROOT" ]
|
||||
set flakePath "$VALHALLA_FLAKE_ROOT"
|
||||
end
|
||||
|
||||
if [ -n "$config" ]
|
||||
set config ".$config"
|
||||
set _flag_apply "_: ($_flag_apply) ((import $(realpath --relative-to (pwd) "$(status dirname)/../../../lib/eval-attribute.nix")) _)"
|
||||
|
@ -21,6 +26,6 @@ function evalFlake --argument-names config property
|
|||
PROPERTY="$property" \
|
||||
nix eval --impure --extra-experimental-features "nix-command flakes" \
|
||||
--apply "$_flag_apply" \
|
||||
"$(realpath (status dirname))/../../..#valhalla$config" \
|
||||
"$flakePath#valhalla$config" \
|
||||
$argv
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue