Skip to content

Commit dd30939

Browse files
committed
feat(uv): add uv package and clean up code comments
1 parent 9570ec5 commit dd30939

4 files changed

Lines changed: 26 additions & 22 deletions

File tree

programs/uv.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ pkgs, ... }:
2+
3+
{
4+
home.packages = [
5+
pkgs.uv
6+
];
7+
8+
programs.bash.shellAliases = {
9+
uvp = "uv pip";
10+
uvv = "uv venv";
11+
};
12+
}

switch.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ target="brantes@${arch}.${os}.${device}"
2222

2323
info "Environment Detected: ${arch} | ${os} | ${device}"
2424

25-
# --- Test Enforcement ---
2625
info "Running configuration tests (via Pytest)..."
27-
28-
# Run pytest inside a temporary nix-shell with python3 and pytest
2926
if nix-shell -p python3Packages.pytest --run "pytest tests/"; then
3027
success "All tests passed."
3128
else
3229
error "Tests failed! Aborting switch to prevent broken configuration."
3330
fi
34-
# ------------------------
3531

3632
info "Applying target: .#${target}"
3733

@@ -44,5 +40,4 @@ if [[ "$os" == "android" ]]; then
4440
home-manager switch --flake ".#${target}"
4541
fi
4642
export HOME="/home/brantes"
47-
fi
48-
43+
fi

tests/conftest.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,25 @@
44
import sys
55
from pathlib import Path
66

7-
# Detect target architecture similar to switch.sh logic
87
def get_flake_target():
98
arch = subprocess.check_output(["uname", "-m"]).decode().strip()
109

11-
# Simple detection logic aligned with switch.sh
1210
if os.path.exists("/data/data/com.termux") or os.path.exists("/system/build.prop"):
1311
os_name = "android"
1412
device = "smartphone"
1513
elif "Microsoft" in os.uname().release or "WSL" in os.uname().release:
1614
os_name = "wsl"
1715
device = "desktop"
1816
else:
19-
# Default fallback for standard Linux
2017
os_name = "linux"
2118
device = "desktop"
2219

23-
return f"homeConfigurations.\"brantes@{arch}.{os_name}.{device}\".activationPackage"
20+
return f'homeConfigurations."brantes@{arch}.{os_name}.{device}".activationPackage'
2421

2522
@pytest.fixture(scope="session")
2623
def home_manager_build(tmp_path_factory):
27-
"""
28-
Builds the Home Manager configuration once per test session.
29-
Returns the Path to the build result.
30-
"""
24+
"""Builds the Home Manager configuration once per test session."""
3125
target = get_flake_target()
32-
print(f"\n[setup] Building target: {target}")
33-
34-
# Create a temporary directory for the build link
3526
out_link = tmp_path_factory.mktemp("build") / "result"
3627

3728
cmd = [
@@ -46,8 +37,4 @@ def home_manager_build(tmp_path_factory):
4637
except subprocess.CalledProcessError as e:
4738
pytest.fail(f"Nix build failed:\n{e.stderr.decode()}")
4839

49-
# Resolve the symlink to the actual store path
50-
real_path = out_link.resolve()
51-
print(f"[setup] Build successful at: {real_path}")
52-
53-
return real_path
40+
return out_link.resolve()

tests/programs/test_uv.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def test_uv_installed(home_manager_build):
2+
"""Verifies that the uv binary is available in the build output."""
3+
uv_bin = home_manager_build / "home-path/bin/uv"
4+
assert uv_bin.exists()
5+
6+
def test_uv_aliases(home_manager_build):
7+
"""Verifies that uv aliases are present in the bashrc."""
8+
bashrc = home_manager_build / "home-files/.bashrc"
9+
content = bashrc.read_text()
10+
assert "uvp=" in content

0 commit comments

Comments
 (0)