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