Skip to content

Commit 20001f9

Browse files
committed
test(login-shell): fix home-manager URL
1 parent d34d941 commit 20001f9

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

tests/lib/lib.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ function Remove-Escapes {
1515
}
1616
}
1717

18-
# Implementation-independent base class
1918
class Distro {
2019
[string]$id
2120
[string]$tempdir

tests/login-shell/login-shell.Tests.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ Describe "Login Shell" {
1414
$output | Select-Object -Index ($output.Length - 2) | Should -Match "login_shell\s*on"
1515
}
1616

17-
It "should be possible to access home manager sessionVariables" {
17+
It "should be possible to install a configuration that uses home-manager session variables" {
1818
$distro.InstallConfig("$PSScriptRoot/session-variables.nix", "switch")
19+
}
1920

20-
# Session variable file should exist
21+
It "should have created the hm-session-vars.sh file" {
2122
$distro.Launch("test -f ~/.nix-profile/etc/profile.d/hm-session-vars.sh")
2223
$LASTEXITCODE | Should -Be 0
24+
}
2325

26+
It "should be possible to access home manager sessionVariables in bash" {
2427
Write-Host "> echo `$TEST_VARIABLE"
2528
Write-Output "echo `$TEST_VARIABLE" | wsl -d $distro.id | Tee-Object -Variable output | Write-Host
2629
$output | Select-Object -Last 1 | Should -BeExactly "THISISATESTSTRING"

tests/login-shell/session-variables.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
{ pkgs, lib, ... }:
22
let
33
ver = with lib; substring 0 5 version;
4+
hmBranch =
5+
let
6+
# Use the nix parser conveniently built into nix
7+
flake = import <nixos-wsl/flake.nix>;
8+
url = flake.inputs.nixpkgs.url;
9+
version = lib.removePrefix "github:NixOS/nixpkgs/nixos-" url;
10+
in
11+
if version == "unstable"
12+
then "master"
13+
else "release-" + version;
414
in
515
{
616
imports = [
717
<nixos-wsl/modules>
8-
"${builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${ver}.tar.gz"}/nixos"
18+
"${builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/${hmBranch}.tar.gz"}/nixos"
919
];
1020

1121
wsl.enable = true;

0 commit comments

Comments
 (0)