add laptop version
This commit is contained in:
parent
0ba7bf856f
commit
c7db34c243
729 changed files with 286689 additions and 18 deletions
48
hosts/nixos-laptop/README-laptop.md
Normal file
48
hosts/nixos-laptop/README-laptop.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Host `nixos-laptop` — ThinkPad E560
|
||||
|
||||
Profil **léger et faible RAM (4 Gio)** : i5-6200U, Intel HD 520 (pas de GPU
|
||||
dédié), pas de Steam, pas de Noctalia (remplacé par `mako`), pas de gros stack
|
||||
KDE (on utilise `nautilus`).
|
||||
|
||||
## Installer
|
||||
```bash
|
||||
./install.sh nixos-laptop # ou ./install.sh puis choisir 2
|
||||
```
|
||||
Le script pousse explicitement les caches binaires (cache.nixos.org, Hyprland,
|
||||
nix-community) dès le premier rebuild → quasiment aucune compilation locale.
|
||||
|
||||
## Mettre à jour
|
||||
```bash
|
||||
./update.sh nixos-laptop # ou juste ./update.sh (détecte le hostname)
|
||||
```
|
||||
|
||||
## Faible RAM — ce qui est en place (`config/low-ram.nix`)
|
||||
- `max-jobs = 1`, `cores = 2` : on ne sature pas les 4 Gio pendant un build.
|
||||
- `builders-use-substitutes`, `fallback`, 3 caches binaires : on télécharge
|
||||
du pré-compilé au lieu de compiler.
|
||||
- `zramSwap` 150 % en zstd + `vm.swappiness = 180` : swap compressé rapide.
|
||||
- `earlyoom` : tue proprement le process le plus gourmand avant un freeze total.
|
||||
|
||||
### Si un rebuild rame quand même
|
||||
Un paquet absent des caches sera compilé localement. Deux options :
|
||||
1. Éviter les inputs qui forcent la compilation (ex. builds custom).
|
||||
2. Créer ton propre cache Cachix et y pousser depuis le poste maison :
|
||||
```bash
|
||||
# sur le poste maison, après un build :
|
||||
cachix push mon-cache ./result
|
||||
```
|
||||
puis ajouter `https://mon-cache.cachix.org` aux `substituters` de
|
||||
`config/low-ram.nix`. Le laptop récupèrera alors les binaires sans compiler.
|
||||
|
||||
## Noms de paquets à vérifier (traduits depuis pacman/AUR)
|
||||
Je n'ai pas pu évaluer contre nixpkgs ici. Vérifie ceux-ci si un rebuild
|
||||
échoue sur un attribut manquant (`nix search nixpkgs <nom>`) :
|
||||
- `planify` (≈ `planner`), `nomacs`, `han-nom`, `bitwarden-cli`,
|
||||
`bitwarden-desktop`, `mattermost-desktop`, `vaapiIntel` (peut être aliasé).
|
||||
- Toolkits Octave : `image`, `statistics`, `symbolic` OK ; `dataframe` est
|
||||
commenté (indispo).
|
||||
- `octave-datatypes`, `grimblast`, `zen-browser` : gérés autrement (input zen,
|
||||
grim/slurp), pas besoin de l'AUR.
|
||||
|
||||
## Empreinte digitale
|
||||
`services.fprintd.enable = true`. Enrôle avec `fprintd-enroll` après install.
|
||||
7
hosts/nixos-laptop/config/bluetooth.nix
Normal file
7
hosts/nixos-laptop/config/bluetooth.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
hardware.bluetooth.enable = true;
|
||||
hardware.bluetooth.powerOnBoot = true;
|
||||
services.blueman.enable = true;
|
||||
}
|
||||
|
||||
20
hosts/nixos-laptop/config/boot.nix
Normal file
20
hosts/nixos-laptop/config/boot.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# Noyau standard (pas forcément le _latest : plus léger à récupérer
|
||||
# depuis le cache et suffisant pour du Skylake).
|
||||
boot.kernelPackages = pkgs.linuxPackages;
|
||||
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
device = "nodev";
|
||||
efiSupport = true;
|
||||
useOSProber = true;
|
||||
configurationLimit = 5; # moins de générations = moins de disque
|
||||
};
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# NB : si tu as choisi le chiffrement LUKS à l'installation, l'entrée
|
||||
# boot.initrd.luks.devices.* correspondante est déjà générée dans
|
||||
# hardware-configuration.nix par nixos-generate-config. On ne la
|
||||
# duplique donc PAS ici (l'UUID est propre à ce disque).
|
||||
}
|
||||
18
hosts/nixos-laptop/config/drivers_video.nix
Normal file
18
hosts/nixos-laptop/config/drivers_video.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# ThinkPad E560 : GPU Intel HD Graphics 520 (Skylake) intégré uniquement.
|
||||
# Pas de GPU dédié → configuration bien plus simple que le poste maison.
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver # VAAPI moderne pour Skylake (iHD)
|
||||
intel-vaapi-driver # ancien driver i965 (fallback)
|
||||
libvdpau-va-gl
|
||||
];
|
||||
};
|
||||
|
||||
# Force le driver VAAPI moderne (meilleure accélération vidéo).
|
||||
environment.sessionVariables = {
|
||||
LIBVA_DRIVER_NAME = "iHD";
|
||||
};
|
||||
}
|
||||
18
hosts/nixos-laptop/config/extra-services.nix
Normal file
18
hosts/nixos-laptop/config/extra-services.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# ── Mullvad VPN ── (remplace mullvad-vpn-bin de l'AUR)
|
||||
services.mullvad-vpn = {
|
||||
enable = true;
|
||||
package = pkgs.mullvad-vpn;
|
||||
};
|
||||
|
||||
# Pas de Steam / gamemode / gamescope ici : machine légère.
|
||||
|
||||
# ── Intégration gestionnaire de fichiers (miniatures, montage…) ──
|
||||
services.gvfs.enable = true;
|
||||
services.tumbler.enable = true;
|
||||
|
||||
environment.sessionVariables = {
|
||||
NIXOS_OZONE_WL = "1";
|
||||
};
|
||||
}
|
||||
39
hosts/nixos-laptop/config/fonts.nix
Normal file
39
hosts/nixos-laptop/config/fonts.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
fonts.packages = with pkgs; [
|
||||
# Sans / Source (adobe-source-*-fonts, source-han-sans)
|
||||
source-sans
|
||||
source-serif
|
||||
source-han-sans # adobe-source-han-sans-otc-fonts
|
||||
source-han-serif
|
||||
|
||||
# Noto + emoji + CJK (noto-fonts-cjk, noto-fonts-emoji)
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-cjk-serif
|
||||
noto-fonts-color-emoji
|
||||
|
||||
# Microsoft / Windows (ttf-ms-fonts + corefonts)
|
||||
corefonts
|
||||
vista-fonts # tahoma, etc. (unfree)
|
||||
|
||||
# Latin Modern / TeX Gyre (otf-latin-modern, tex-gyre-math)
|
||||
lmodern
|
||||
gyre-fonts
|
||||
|
||||
# Accessibilité (ttf-luciole)
|
||||
texlivePackages.luciole
|
||||
|
||||
|
||||
# Nerd fonts / symboles (ttf-nerd-fonts-symbols, font-awesome, woff2-font-awesome)
|
||||
nerd-fonts.symbols-only
|
||||
font-awesome
|
||||
|
||||
# Fontes de code utiles
|
||||
fira-code
|
||||
jetbrains-mono
|
||||
|
||||
dejavu_fonts
|
||||
liberation_ttf
|
||||
];
|
||||
}
|
||||
16
hosts/nixos-laptop/config/hyprland.nix
Normal file
16
hosts/nixos-laptop/config/hyprland.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
||||
};
|
||||
|
||||
# Portails XDG (captures d'écran, partage d'écran, file pickers Wayland)
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
|
||||
};
|
||||
|
||||
security.polkit.enable = true;
|
||||
# Les substituters/caches sont centralisés dans low-ram.nix.
|
||||
}
|
||||
20
hosts/nixos-laptop/config/language.nix
Normal file
20
hosts/nixos-laptop/config/language.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
time.timeZone = "Europe/Paris";
|
||||
|
||||
i18n.defaultLocale = "fr_FR.UTF-8";
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "fr_FR.UTF-8";
|
||||
LC_IDENTIFICATION = "fr_FR.UTF-8";
|
||||
LC_MEASUREMENT = "fr_FR.UTF-8";
|
||||
LC_MONETARY = "fr_FR.UTF-8";
|
||||
LC_NAME = "fr_FR.UTF-8";
|
||||
LC_NUMERIC = "fr_FR.UTF-8";
|
||||
LC_PAPER = "fr_FR.UTF-8";
|
||||
LC_TELEPHONE = "fr_FR.UTF-8";
|
||||
LC_TIME = "fr_FR.UTF-8";
|
||||
};
|
||||
console = {
|
||||
keyMap = "fr-latin1";
|
||||
};
|
||||
}
|
||||
71
hosts/nixos-laptop/config/low-ram.nix
Normal file
71
hosts/nixos-laptop/config/low-ram.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# Machine à faible RAM (4 GiB) : on privilégie TOUJOURS les
|
||||
# binaires pré-compilés (caches) plutôt que la compilation locale.
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
nix.settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Caches binaires : on récupère un maximum de paquets déjà
|
||||
# compilés pour éviter de compiler sur cette machine.
|
||||
substituters = [
|
||||
"https://cache.nixos.org"
|
||||
"https://hyprland.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
trusted-substituters = [
|
||||
"https://cache.nixos.org"
|
||||
"https://hyprland.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
trusted-users = [ "root" "@wheel" ];
|
||||
|
||||
# Toujours interroger les caches, ne jamais partir du principe
|
||||
# qu'un paquet doit être compilé localement.
|
||||
builders-use-substitutes = true;
|
||||
fallback = true; # si un cache tombe, on tente ailleurs
|
||||
connect-timeout = 10;
|
||||
|
||||
# Limiter la pression mémoire pendant la construction :
|
||||
# peu de jobs en parallèle, sinon 4 Gio saturent vite.
|
||||
max-jobs = 1; # une dérivation à la fois
|
||||
cores = 2; # les 2 cœurs du i5-6200U par job
|
||||
};
|
||||
|
||||
# Auto-optimisation du store (déduplication) pour économiser le disque.
|
||||
nix.settings.auto-optimise-store = true;
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# zram : swap compressé en RAM. Indispensable avec 4 Gio, à la
|
||||
# fois pour l'usage courant et pour absorber les pics du rebuild.
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
algorithm = "zstd";
|
||||
memoryPercent = 150; # jusqu'à 1.5x la RAM (zstd compresse ~3:1)
|
||||
priority = 100;
|
||||
};
|
||||
|
||||
# Le noyau peut « swaper » agressivement vers zram (rapide) plutôt
|
||||
# que de tuer des process pendant un build.
|
||||
boot.kernel.sysctl = {
|
||||
"vm.swappiness" = 180; # favorise zram
|
||||
"vm.watermark_boost_factor" = 0;
|
||||
"vm.watermark_scale_factor" = 125;
|
||||
"vm.page-cluster" = 0; # recommandé avec zram
|
||||
};
|
||||
|
||||
# earlyoom : tue proprement le process le plus gourmand avant que la
|
||||
# machine ne se fige totalement (utile si un build déborde malgré tout).
|
||||
services.earlyoom = {
|
||||
enable = true;
|
||||
freeMemThreshold = 5; # agit quand il reste < 5% de RAM libre
|
||||
freeSwapThreshold = 5;
|
||||
};
|
||||
}
|
||||
23
hosts/nixos-laptop/config/power_management.nix
Normal file
23
hosts/nixos-laptop/config/power_management.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# ThinkPad E560 : TLP pour l'autonomie. Pas d'asusd (spécifique ASUS).
|
||||
services.tlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
||||
# Seuils de charge batterie (préserve la batterie).
|
||||
# Fonctionne sur la plupart des ThinkPad via tp_smapi/acpi.
|
||||
START_CHARGE_THRESH_BAT0 = 40;
|
||||
STOP_CHARGE_THRESH_BAT0 = 80;
|
||||
};
|
||||
};
|
||||
services.power-profiles-daemon.enable = false;
|
||||
|
||||
# Économie d'énergie supplémentaire.
|
||||
powerManagement.enable = true;
|
||||
|
||||
# Lecteur d'empreintes (paquet fprintd de la liste pacman).
|
||||
services.fprintd.enable = true;
|
||||
}
|
||||
12
hosts/nixos-laptop/config/sound.nix
Normal file
12
hosts/nixos-laptop/config/sound.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
}
|
||||
29
hosts/nixos-laptop/config/system_packages.nix
Normal file
29
hosts/nixos-laptop/config/system_packages.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# Outils système / build essentiels (équiv. base-devel, git, etc.).
|
||||
# Les applis graphiques utilisateur sont dans home-manager (home/).
|
||||
environment.systemPackages = with pkgs; [
|
||||
# base / build
|
||||
git vim gnumake gcc wget curl unzip tree
|
||||
|
||||
# CLI utiles présents dans ta liste pacman
|
||||
btop # btop
|
||||
fastfetch # fastfetch
|
||||
ripgrep # ripgrep
|
||||
tmux # tmux
|
||||
translate-shell # translate-shell
|
||||
xclip # xclip
|
||||
wl-clipboard # wl-clipboard
|
||||
pass # pass
|
||||
bitwarden-cli # (bitwarden : GUI côté user, CLI ici)
|
||||
powertop # powertop
|
||||
brightnessctl # brightnessctl
|
||||
ntfs3g # ntfs-3g
|
||||
pciutils usbutils inxi # inxi + diagnostics
|
||||
gnupg
|
||||
pinentry-curses
|
||||
];
|
||||
|
||||
# Empreintes digitales / imprimante / flatpak déclarés en services.
|
||||
services.flatpak.enable = true; # flatpak
|
||||
}
|
||||
10
hosts/nixos-laptop/config/system_saves.nix
Normal file
10
hosts/nixos-laptop/config/system_saves.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
17
hosts/nixos-laptop/config/system_services.nix
Normal file
17
hosts/nixos-laptop/config/system_services.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
networking = {
|
||||
hostName = "nixos-laptop";
|
||||
networkmanager.enable = true;
|
||||
# ouvrir des ports manuellement si besoin
|
||||
firewall.enable = true;
|
||||
};
|
||||
services = {
|
||||
xserver.xkb = {
|
||||
layout = "fr";
|
||||
variant = "";
|
||||
};
|
||||
printing.enable = true;
|
||||
openssh.enable = false;
|
||||
};
|
||||
}
|
||||
10
hosts/nixos-laptop/config/user.nix
Normal file
10
hosts/nixos-laptop/config/user.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
users.users.afoucaultc = {
|
||||
isNormalUser = true;
|
||||
description = "afoucaultc";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
programs.zsh.enable = true;
|
||||
}
|
||||
31
hosts/nixos-laptop/configuration.nix
Normal file
31
hosts/nixos-laptop/configuration.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
# généré à l'installation avec nixos-generate-config
|
||||
./hardware-configuration.nix
|
||||
./config/bluetooth.nix
|
||||
./config/boot.nix
|
||||
./config/drivers_video.nix
|
||||
./config/extra-services.nix
|
||||
./config/fonts.nix
|
||||
./config/hyprland.nix
|
||||
./config/language.nix
|
||||
./config/low-ram.nix
|
||||
./config/power_management.nix
|
||||
./config/sound.nix
|
||||
./config/system_packages.nix
|
||||
./config/system_saves.nix
|
||||
./config/system_services.nix
|
||||
./config/user.nix
|
||||
# profil nixos-hardware pour le ThinkPad E560 (Skylake, i5-6200U)
|
||||
# nécessite l'input nixos-hardware dans flake.nix.
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
||||
inputs.nixos-hardware.nixosModules.common-pc-laptop
|
||||
inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
system.stateVersion = "25.11";
|
||||
nixpkgs.config.permittedInsecurePackages = [
|
||||
"electron-39.8.10"
|
||||
];
|
||||
}
|
||||
33
hosts/nixos-laptop/hardware-configuration.nix
Normal file
33
hosts/nixos-laptop/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "rtsx_pci_sdmmc" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/mapper/cryptroot";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/b773a1eb-b293-4498-9090-a26843bdcd5f";
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/6EA9-3F92";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
swapDevices = [ { device = "/swapfile"; size = 8192; } ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue