From e6b1129f9d3c2010fba981307c72ad7d15717d3d Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 29 Sep 2023 20:51:59 +0300 Subject: feat: rewrite tarball generation to use proper nixos-install + nixos-enter Supersedes #243. --- tests/lib/lib.ps1 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tests/lib/lib.ps1') diff --git a/tests/lib/lib.ps1 b/tests/lib/lib.ps1 index 58b1a42..c9e9267 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 @@ -75,7 +72,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 @@ -96,7 +93,7 @@ class DockerDistro : Distro { [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 } @@ -140,7 +137,7 @@ class WslDistro : Distro { [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 } -- cgit v1.2.3 From c9f4d0bbca055b5fb4bd8394397d0ffa2cd6efe1 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 29 Sep 2023 22:02:48 +0300 Subject: fix: update channels when installing distro under test --- tests/lib/lib.ps1 | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/lib/lib.ps1') diff --git a/tests/lib/lib.ps1 b/tests/lib/lib.ps1 index c9e9267..006eefe 100644 --- a/tests/lib/lib.ps1 +++ b/tests/lib/lib.ps1 @@ -88,6 +88,8 @@ class DockerDistro : Distro { if ($LASTEXITCODE -ne 0) { throw "Failed to launch container" } + + $this.Launch("sudo nix-channel --update") } [Array]Launch([string]$command) { @@ -132,6 +134,8 @@ 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) { -- cgit v1.2.3 From 5bca9165acee81d3187fb75df858db765de102cd Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 29 Sep 2023 22:36:09 +0300 Subject: cleanup: clean up tests, don't rely on base config --- tests/lib/lib.ps1 | 4 ---- 1 file changed, 4 deletions(-) (limited to 'tests/lib/lib.ps1') diff --git a/tests/lib/lib.ps1 b/tests/lib/lib.ps1 index 006eefe..e3985c9 100644 --- a/tests/lib/lib.ps1 +++ b/tests/lib/lib.ps1 @@ -37,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 -- cgit v1.2.3