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");
|
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
|
||||||
fish -c ". $escapedPath; $Script";
|
fish -c ". $escapedPath; $Script";
|
||||||
} else {
|
} else {
|
||||||
$cleanup = { };
|
if (-not $env:VALHALLA_FLAKE_ROOT) {
|
||||||
$projectRoot = "$PSScriptRoot/../../..";
|
$cleanup = { };
|
||||||
$archisoDir = "$projectRoot/archiso";
|
$projectRoot = "$PSScriptRoot/../../..";
|
||||||
|
$archisoDir = "$projectRoot/archiso";
|
||||||
|
|
||||||
if (Test-Path -PathType Container "$archisoDir") {
|
if (Test-Path -PathType Container "$archisoDir") {
|
||||||
$git = {
|
$git = {
|
||||||
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
|
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
|
||||||
};
|
};
|
||||||
|
|
||||||
& $git rm -r --cached "$archisoDir" *> $null;
|
& $git rm -r --cached "$archisoDir" *> $null;
|
||||||
$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";
|
||||||
|
@ -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