add laptop version
This commit is contained in:
parent
0ba7bf856f
commit
c7db34c243
729 changed files with 286689 additions and 18 deletions
64
install.sh
64
install.sh
|
|
@ -1,7 +1,63 @@
|
|||
#!/usr/bin/env bash
|
||||
# ─────────────────────────────────────────────────────────────────────
|
||||
# Installation NixOS — choix de la machine (host)
|
||||
# Usage :
|
||||
# ./install.sh → menu interactif
|
||||
# ./install.sh nixos-home → poste maison
|
||||
# ./install.sh nixos-laptop → ThinkPad E560 (léger, faible RAM)
|
||||
# ─────────────────────────────────────────────────────────────────────
|
||||
set -euo pipefail
|
||||
export NIX_CONFIG="experimental-features = nix-command flakes"
|
||||
|
||||
# Clés publiques des caches (identiques pour tous les hosts).
|
||||
PUBKEYS="cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
|
||||
# ── 1. Choix du host ─────────────────────────────────────────────────
|
||||
HOST="${1:-}"
|
||||
if [ -z "$HOST" ]; then
|
||||
echo "Quelle machine installer ?"
|
||||
echo " 1) nixos-home (poste maison)"
|
||||
echo " 2) nixos-laptop (ThinkPad E560 — léger, faible RAM)"
|
||||
read -rp "Choix [1/2] : " choix
|
||||
case "$choix" in
|
||||
1) HOST="nixos-home" ;;
|
||||
2) HOST="nixos-laptop" ;;
|
||||
*) echo "Choix invalide." ; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -d "$HOME/nixos-config/hosts/$HOST" ]; then
|
||||
echo "Host inconnu : $HOST"
|
||||
echo "Hosts disponibles :"
|
||||
ls "$HOME/nixos-config/hosts/"
|
||||
exit 1
|
||||
fi
|
||||
echo "→ Installation du host : $HOST"
|
||||
|
||||
# Substituters : on ajoute nix-community en plus pour le laptop.
|
||||
if [ "$HOST" = "nixos-laptop" ]; then
|
||||
SUBS="https://cache.nixos.org https://hyprland.cachix.org https://nix-community.cachix.org"
|
||||
else
|
||||
SUBS="https://cache.nixos.org https://hyprland.cachix.org"
|
||||
fi
|
||||
|
||||
# ── 2. Copie du hardware-configuration généré ────────────────────────
|
||||
cd
|
||||
cp /etc/nixos/hardware-configuration.nix ~/nixos-config/hosts/nixos-home/hardware-configuration.nix
|
||||
cd ~/nixos-config
|
||||
nix-shell -p git --run 'git add hosts/nixos-home/hardware-configuration.nix'
|
||||
nix-shell -p git --run 'sudo nixos-rebuild switch --flake .#nixos-home --option substituters "https://cache.nixos.org https://hyprland.cachix.org" --option trusted-public-keys "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="'
|
||||
cp /etc/nixos/hardware-configuration.nix \
|
||||
"$HOME/nixos-config/hosts/$HOST/hardware-configuration.nix"
|
||||
|
||||
cd "$HOME/nixos-config"
|
||||
nix-shell -p git --run "git add hosts/$HOST/hardware-configuration.nix"
|
||||
|
||||
# ── 3. Rebuild en s'appuyant au MAXIMUM sur les caches binaires ──────
|
||||
# Les options --substituters / --trusted-public-keys sont passées
|
||||
# explicitement pour que même le TOUT PREMIER rebuild (avant que la conf
|
||||
# ne soit active) télécharge les binaires au lieu de compiler → crucial
|
||||
# sur la machine à 4 Gio de RAM.
|
||||
nix-shell -p git --run "sudo nixos-rebuild switch \
|
||||
--flake .#$HOST \
|
||||
--option substituters \"$SUBS\" \
|
||||
--option trusted-public-keys \"$PUBKEYS\" \
|
||||
--option max-jobs 1"
|
||||
|
||||
echo "✓ Terminé pour $HOST. Reboot puis sélectionne la génération dans GRUB."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue