diff options
Diffstat (limited to 'tests/lib/lib.ps1')
| -rw-r--r-- | tests/lib/lib.ps1 | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/lib/lib.ps1 b/tests/lib/lib.ps1 index 58b1a42..e3985c9 100644 --- a/tests/lib/lib.ps1 +++ b/tests/lib/lib.ps1 @@ -26,12 +26,9 @@ class Distro { [string]FindTarball() { # Check if a fresh tarball exists in result, otherwise try one in the current directory - $tarball = "./result/tarball/nixos-wsl-installer.tar.gz" + $tarball = "./nixos-wsl.tar.gz" if (!(Test-Path $tarball)) { - $tarball = "./nixos-wsl-installer.tar.gz" - if (!(Test-Path $tarball)) { - throw "Could not find the installer tarball! Run nix build first, or place one in the current directory." - } + throw "Could not find the tarball! Run nix build first, or place one in the current directory." } Write-Host "Using tarball: $tarball" return $tarball @@ -40,10 +37,6 @@ class Distro { [void]InstallConfig([string]$path) { Write-Host "Installing config: $path" - # Move config out of the way - $this.Launch("/bin/sh -c 'test -f /etc/nixos/base.nix || sudo mv /etc/nixos/configuration.nix /etc/nixos/base.nix'") - $LASTEXITCODE | Should -Be 0 - # Copy the new config $this.Launch("sudo cp $($this.GetPath($path)) /etc/nixos/configuration.nix") $LASTEXITCODE | Should -Be 0 @@ -75,7 +68,7 @@ class DockerDistro : Distro { $tarball = $this.FindTarball() if (!([DockerDistro]::imageCreated)) { - # Build docker image from the installer tarball + # Build docker image from the tarball $tmpdir = $(mktemp -d) Copy-Item $PSScriptRoot/Dockerfile $tmpdir Copy-Item $tarball $tmpdir @@ -91,12 +84,14 @@ class DockerDistro : Distro { if ($LASTEXITCODE -ne 0) { throw "Failed to launch container" } + + $this.Launch("sudo nix-channel --update") } [Array]Launch([string]$command) { Write-Host "> $command" $result = @() - docker exec -t $this.id /nix/nixos-wsl/entrypoint -c $command | Tee-Object -Variable result | Write-Host + docker exec -t $this.id /bin/syschdemd -c $command | Tee-Object -Variable result | Write-Host return $result | Remove-Escapes } @@ -135,12 +130,14 @@ class WslDistro : Distro { throw "Failed to import distro" } & wsl.exe --list | Should -Contain $this.id + + $this.Launch("sudo nix-channel --update") } [Array]Launch([string]$command) { Write-Host "> $command" $result = @() - & wsl.exe -d $this.id -e /nix/nixos-wsl/entrypoint -c $command | Tee-Object -Variable result | Write-Host + & wsl.exe -d $this.id -e /bin/syschdemd -c $command | Tee-Object -Variable result | Write-Host return $result | Remove-Escapes } |
