mirror of
https://github.com/celesrenata/end-4-flakes.git
synced 2026-06-11 04:29:27 -05:00
Revert to activation-time build with caching (network not available in sandbox)
This commit is contained in:
@@ -161,17 +161,6 @@ else:
|
|||||||
|
|
||||||
echo "🎉 Python environment test complete!"
|
echo "🎉 Python environment test complete!"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Build Python venv as a derivation (happens during build, not activation)
|
|
||||||
venvDerivation = pkgs.runCommand "dots-hyprland-venv" {
|
|
||||||
buildInputs = [ pkgs.python312 ];
|
|
||||||
nativeBuildInputs = with pkgs; [ cmake pkg-config gcc gnumake wayland wayland-protocols ];
|
|
||||||
} ''
|
|
||||||
export HOME=$TMPDIR
|
|
||||||
mkdir -p $out
|
|
||||||
${setupVenvScript}
|
|
||||||
mv $HOME/.local/state/quickshell/.venv $out/venv
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.programs.dots-hyprland.python = {
|
options.programs.dots-hyprland.python = {
|
||||||
@@ -233,14 +222,22 @@ in
|
|||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
|
||||||
# Symlink to pre-built venv (built during nixos-rebuild, not activation)
|
# Set up virtual environment on Home Manager activation
|
||||||
|
# Only rebuilds if packages change
|
||||||
home.activation.setupDotsHyprlandVenv = mkIf cfg.autoSetup (
|
home.activation.setupDotsHyprlandVenv = mkIf cfg.autoSetup (
|
||||||
lib.hm.dag.entryAfter ["writeBoundary"] ''
|
lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
echo "🔗 Linking pre-built Python venv..."
|
VENV_PATH="${cfg.venvPath}"
|
||||||
$DRY_RUN_CMD mkdir -p $(dirname ${cfg.venvPath})
|
MARKER_FILE="$VENV_PATH/.nix-built"
|
||||||
$DRY_RUN_CMD rm -rf ${cfg.venvPath}
|
EXPECTED_HASH="${builtins.hashString "sha256" setupVenvScript}"
|
||||||
$DRY_RUN_CMD cp -r ${venvDerivation}/venv ${cfg.venvPath}
|
|
||||||
echo "✅ Python venv linked successfully"
|
# Only rebuild if venv doesn't exist or script changed
|
||||||
|
if [[ ! -f "$MARKER_FILE" ]] || [[ "$(cat "$MARKER_FILE" 2>/dev/null)" != "$EXPECTED_HASH" ]]; then
|
||||||
|
echo "🐍 Building Python venv (this takes ~10 minutes on first run)..."
|
||||||
|
$DRY_RUN_CMD ${setupVenvScript}
|
||||||
|
$DRY_RUN_CMD echo "$EXPECTED_HASH" > "$MARKER_FILE"
|
||||||
|
else
|
||||||
|
echo "✅ Python venv already up to date"
|
||||||
|
fi
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user