Add Hyprland skill and configuration files; enhance installation process with GPU detection and SDDM support
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import * as p from "@clack/prompts";
|
||||
import { groups, packages, toDirs } from "./packages.js";
|
||||
import { detectGpuVendors, driverPackagesFor } from "./gpu.js";
|
||||
import {
|
||||
backupConflicts,
|
||||
ensureSddmEnabled,
|
||||
ensureYay,
|
||||
ensureZsh,
|
||||
installPackages,
|
||||
stow,
|
||||
writeNvidiaEnvConfig,
|
||||
writeState,
|
||||
} from "./stow.js";
|
||||
|
||||
@@ -36,10 +39,33 @@ export async function install() {
|
||||
if (p.isCancel(picks)) return p.cancel("Install cancelled.");
|
||||
for (const name of picks as string[]) chosen.add(name);
|
||||
|
||||
const gpuVendors = detectGpuVendors();
|
||||
const gpuOptions = gpuVendors.flatMap((vendor) =>
|
||||
driverPackagesFor([vendor]).map((pkg) => ({ value: pkg, label: `${vendor}: ${pkg}` })),
|
||||
);
|
||||
let gpuPicks: string[] = [];
|
||||
if (gpuOptions.length > 0) {
|
||||
const picked = await p.multiselect({
|
||||
message: "Detected GPU(s) — confirm driver packages to install",
|
||||
options: gpuOptions,
|
||||
initialValues: gpuOptions.map((o) => o.value),
|
||||
required: false,
|
||||
});
|
||||
if (p.isCancel(picked)) return p.cancel("Install cancelled.");
|
||||
gpuPicks = picked as string[];
|
||||
for (const name of gpuPicks) chosen.add(name);
|
||||
}
|
||||
|
||||
installPackages([...chosen]);
|
||||
|
||||
ensureSddmEnabled();
|
||||
|
||||
if (chosen.has("zsh")) ensureZsh();
|
||||
|
||||
if (gpuVendors.includes("nvidia") && driverPackagesFor(["nvidia"]).some((pkg) => gpuPicks.includes(pkg))) {
|
||||
writeNvidiaEnvConfig();
|
||||
}
|
||||
|
||||
const dirs = toDirs([...chosen]);
|
||||
const backupDir = backupConflicts(dirs);
|
||||
if (backupDir) p.log.info(`Backed up conflicting files to ${backupDir}`);
|
||||
|
||||
Reference in New Issue
Block a user