Build Python venv during build phase instead of activation (fixes 11min boot time)

This commit is contained in:
Celes Renata
2025-12-12 11:44:54 -08:00
parent 1338459072
commit 30332c1807
+14 -2
View File
@@ -222,10 +222,22 @@ in
'')
];
# Set up virtual environment on Home Manager activation
# Symlink to pre-built venv (built during nixos-rebuild, not activation)
home.activation.setupDotsHyprlandVenv = mkIf cfg.autoSetup (
lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD ${setupVenvScript}
echo "🔗 Linking pre-built Python venv..."
$DRY_RUN_CMD mkdir -p $(dirname ${cfg.venvPath})
$DRY_RUN_CMD rm -rf ${cfg.venvPath}
$DRY_RUN_CMD cp -r ${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
''}/venv ${cfg.venvPath}
echo " Python venv linked successfully"
''
);