add test for envfs

This commit is contained in:
nzbr
2026-03-18 23:18:21 +01:00
parent 146e7c5e8e
commit e58c9f4b32
2 changed files with 52 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
BeforeAll {
. $PSScriptRoot/../lib/lib.ps1
}
Describe "envfs" {
BeforeAll {
$distro = [Distro]::new()
}
It "should install" {
$distro.InstallConfig("$PSScriptRoot/envfs.nix", "switch")
}
It "should not break the distro" {
$distro.Launch("true")
$LASTEXITCODE | Should -Be 0
}
It "should allow running scripts with #!/bin/python3 instead of #!/usr/bin/env python3" {
$distro.Launch("echo '#!/bin/python3' > ~/test.py")
$LASTEXITCODE | Should -Be 0
$distro.Launch("echo print(`"hello`") >> ~/test.py")
$LASTEXITCODE | Should -Be 0
$distro.Launch("chmod +x ~/test.py")
$LASTEXITCODE | Should -Be 0
$output = $distro.Launch("~/test.py") | Select-Object -Last 1
$output | Should -BeExactly "hello"
$LASTEXITCODE | Should -Be 0
}
AfterAll {
$distro.Uninstall()
}
}
+15
View File
@@ -0,0 +1,15 @@
{ lib, pkgs, ... }:
with lib; {
imports = [
<nixos-wsl/modules>
];
config = {
wsl.enable = true;
services.envfs.enable = true;
environment.systemPackages = [
pkgs.python3
];
};
}