mirror of
https://github.com/nix-community/NixOS-WSL.git
synced 2026-11-07 14:59:35 +00:00
add test for envfs
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ lib, pkgs, ... }:
|
||||
with lib; {
|
||||
imports = [
|
||||
<nixos-wsl/modules>
|
||||
];
|
||||
|
||||
config = {
|
||||
wsl.enable = true;
|
||||
services.envfs.enable = true;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.python3
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user