Aucun changement fonctionnel, juste moins de fichiers à gérer côté admin (structure inspirée de modules/anssi/ : un rôle clair par fichier, mais un seul profil ici donc un seul fichier commun suffit). hosts/usagers/configuration.nix importe désormais juste `../common` (default.nix résolu automatiquement) + le layout disko. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
295 lines
8.8 KiB
Nix
295 lines
8.8 KiB
Nix
# Socle commun à toutes les machines de la flotte (repo public) : compte
|
|
# système, réseau/durcissement, bureau Cinnamon/Firefox. Un seul fichier
|
|
# plutôt que plusieurs petits (base/desktop/accounts) -- chaque option
|
|
# n'a qu'un seul endroit où la chercher.
|
|
{ pkgs, lib, ... }:
|
|
|
|
{
|
|
imports = [ ../../modules/anssi ];
|
|
|
|
# Nom uniforme, pas d'identification individuelle pour l'instant (voir
|
|
# README). À revoir via le numéro de série DMI si le besoin apparaît.
|
|
networking.hostName = "Nixos_Fleet";
|
|
networking.networkmanager.enable = true;
|
|
|
|
# Couverture matérielle maximale (wifi/Bluetooth/PCI) sur un parc
|
|
# hétérogène inconnu à l'avance. Inclut enableRedistributableFirmware.
|
|
hardware.enableAllFirmware = lib.mkDefault true;
|
|
|
|
# Durcissement ANSSI (modules/anssi/, vendored depuis SécurixOS).
|
|
# level "intermediary" : couvre déjà tout ce qui était réglé à la main
|
|
# sur le profil oreo (R9/R11/R12/R14). category "client" : postes de
|
|
# travail, pas des serveurs.
|
|
#
|
|
# R12 force net.ipv4.ip_forward = 0 : sans impact sur des postes
|
|
# clients. Ne pas importer ce module sur pxe-server/configuration.nix
|
|
# (a besoin du forwarding inverse).
|
|
security.anssi = {
|
|
enable = true;
|
|
level = "intermediary";
|
|
category = "client";
|
|
|
|
# R8 (mitigations CPU) coupe l'hyperthreading via "mds=full,nosmt" :
|
|
# trop coûteux sur le matériel bas de gamme du parc. Désactivé via
|
|
# exception plutôt que contourné en silence ; réappliqué ci-dessous
|
|
# sans le "nosmt".
|
|
exceptions.R8.rationale = "SMT conservé : impact perf trop lourd sur le parc (matériel bas de gamme, parfois 4 Go de RAM). Mitigations réappliquées ci-dessous sans 'nosmt'.";
|
|
};
|
|
|
|
# R8 (modules/anssi/kernel-options.nix), sauf mds=full,nosmt -> mds=full.
|
|
boot.kernelParams = [
|
|
"l1tf=full,force"
|
|
"page_poison=on"
|
|
"pti=on"
|
|
"slab_nomerge=yes"
|
|
"slub_debug=FZP"
|
|
"spec_store_bypass_disable=seccomp"
|
|
"spectre_v2=on"
|
|
"mds=full" # sans ",nosmt" : hyperthreading conservé
|
|
"mce=0"
|
|
"page_alloc.shuffle=1"
|
|
"rng_core.default_quality=500"
|
|
];
|
|
|
|
# Pas couvert par le module ANSSI (R45 en exception : AppArmor
|
|
# partiellement supporté sur NixOS).
|
|
systemd.coredump.enable = false;
|
|
security.apparmor.packages = [ pkgs.apparmor-profiles ];
|
|
security.apparmor.enableCache = true;
|
|
|
|
# Bluetooth (même config que le profil oreo) : pas d'allumage auto au
|
|
# boot, blueman pour la gestion depuis Cinnamon.
|
|
hardware.bluetooth = {
|
|
enable = true;
|
|
powerOnBoot = false;
|
|
};
|
|
services.blueman.enable = true;
|
|
|
|
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";
|
|
};
|
|
services.xserver.xkb = {
|
|
layout = "fr";
|
|
variant = "";
|
|
};
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
boot.loader.systemd-boot.configurationLimit = 10;
|
|
|
|
services.openssh.enable = true;
|
|
networking.firewall.enable = true;
|
|
|
|
# Swap compressé en RAM : couvre le bas du parc (4 Go, desktop complet).
|
|
zramSwap = {
|
|
enable = true;
|
|
memoryPercent = 50;
|
|
};
|
|
|
|
nix.settings.experimental-features = [
|
|
"nix-command"
|
|
"flakes"
|
|
];
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
nix.gc = {
|
|
automatic = true;
|
|
dates = "weekly";
|
|
options = "--delete-older-than 30d";
|
|
};
|
|
|
|
# Convergence automatique depuis le repo public, sans netrc. Cadence
|
|
# weekly (même format que oreo, plutôt que daily).
|
|
system.autoUpgrade = {
|
|
enable = true;
|
|
dates = "weekly";
|
|
flake = "git+https://gitea.miniclic.net/Damien/Nixos_Fleet.git#usagers";
|
|
};
|
|
|
|
# Compte admin de la flotte : root, mot de passe "nixos" STABLE (pas
|
|
# d'expiration forcée) -- machines génériques/partagées, un mot de
|
|
# passe connu et constant sur tout le parc est voulu pour
|
|
# l'administration courante. `initialPassword` n'est appliqué qu'à la
|
|
# création du compte : un rebuild/auto-upgrade ultérieur ne le réécrit
|
|
# jamais, mais on ne force pas non plus de changement -- "nixos" doit
|
|
# rester valide indéfiniment sur la flotte. Login root direct autorisé
|
|
# en local (console/tty) ; SSH reste sur le défaut NixOS (clé
|
|
# uniquement), ce mot de passe n'ouvre pas la porte à distance.
|
|
users.mutableUsers = true;
|
|
users.users.root.initialPassword = "nixos";
|
|
|
|
# --- Bureau Cinnamon + Firefox --------------------------------------
|
|
services.xserver.enable = true;
|
|
services.xserver.displayManager.lightdm.enable = true;
|
|
services.xserver.displayManager.lightdm.background = "/etc/nixos/hosts/common/wallpaper/Nix/13977413.png";
|
|
services.xserver.desktopManager.cinnamon.enable = true;
|
|
services.accounts-daemon.enable = true;
|
|
|
|
environment.cinnamon.excludePackages = with pkgs; [
|
|
celluloid
|
|
warpinator
|
|
];
|
|
|
|
# Fond d'écran par défaut (logo NixOS, pas la galerie perso de
|
|
# nixos_cinnamon). Suppose la config installée sur /etc/nixos (voir
|
|
# installer/install.sh).
|
|
environment.etc."dconf/db/local.d/00-background".text = ''
|
|
[org/cinnamon/desktop/background]
|
|
picture-uri='file:///etc/nixos/hosts/common/wallpaper/Nix/13977413.png'
|
|
'';
|
|
system.activationScripts.dconfUpdate.text = "${pkgs.dconf}/bin/dconf update";
|
|
|
|
# Confidentialité générique (pas de SearXNG/DNS perso : repo public).
|
|
programs.firefox = {
|
|
enable = true;
|
|
languagePacks = [ "fr" ];
|
|
|
|
preferences = {
|
|
"privacy.resistFingerprinting" = true;
|
|
"browser.newtabpage.activity-stream.showSponsored" = false;
|
|
"browser.search.suggest.enabled" = false;
|
|
"dom.security.https_only_mode" = true;
|
|
"media.peerconnection.enabled" = false;
|
|
"geo.enabled" = false;
|
|
"network.captive-portal-service.enabled" = false;
|
|
# Do Not Track : plus d'UI depuis les versions récentes de Firefox,
|
|
# mais le pref existe encore et envoie bien l'en-tête DNT=1.
|
|
"privacy.donottrackheader.enabled" = true;
|
|
};
|
|
|
|
policies = {
|
|
DisableTelemetry = true;
|
|
DisablePocket = true;
|
|
DisableFirefoxStudies = true;
|
|
OfferToSaveLogins = false;
|
|
DontCheckDefaultBrowser = true;
|
|
EnableTrackingProtection = {
|
|
Value = true;
|
|
Locked = true;
|
|
};
|
|
|
|
# DuckDuckGo est un moteur intégré à Firefox, pas besoin de l'Add.
|
|
SearchEngines.Default = "DuckDuckGo";
|
|
|
|
# Pubs/contenu sponsorisé sur le nouvel onglet et la barre d'adresse.
|
|
FirefoxHome = {
|
|
SponsoredTopSites = false;
|
|
SponsoredPocket = false;
|
|
Locked = true;
|
|
};
|
|
FirefoxSuggest.SponsoredSuggestions = false;
|
|
|
|
ExtensionSettings = {
|
|
"uBlock0@raymondhill.net" = {
|
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
};
|
|
"jid1-MnnxcxisBPnSXQ@jetpack" = {
|
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
curl
|
|
wget
|
|
htop
|
|
nixfmt
|
|
|
|
# === Office/Notes ===
|
|
libreoffice
|
|
pdfarranger
|
|
simple-scan
|
|
|
|
# === System tools ===
|
|
btop
|
|
unzip
|
|
screenfetch
|
|
tmux
|
|
fwupd
|
|
fwupd-efi
|
|
ncdu
|
|
gdu
|
|
hplip
|
|
gutenprint
|
|
cups
|
|
inxi
|
|
ntfs3g
|
|
|
|
# === Communication/Media ===
|
|
thunderbird
|
|
ffmpeg
|
|
vlc
|
|
mpv
|
|
strawberry
|
|
];
|
|
|
|
# Flatpak
|
|
services.flatpak.enable = true;
|
|
xdg.portal.enable = true;
|
|
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
|
|
|
systemd.services.flatpak-repo = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network-online.target" ];
|
|
wants = [ "network-online.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
path = [ pkgs.flatpak ];
|
|
script = ''
|
|
flatpak remote-add --if-not-exists flathub \
|
|
https://dl.flathub.org/repo/flathub.flatpakrepo
|
|
'';
|
|
};
|
|
|
|
systemd.services.flatpak-install = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [
|
|
"flatpak-repo.service"
|
|
"network-online.target"
|
|
];
|
|
wants = [ "network-online.target" ];
|
|
requires = [ "flatpak-repo.service" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
path = [ pkgs.flatpak ];
|
|
script = ''
|
|
flatpak install -y flathub \
|
|
net.waterfox.waterfox \
|
|
eu.betterbird.Betterbird
|
|
'';
|
|
};
|
|
|
|
systemd.services.flatpak-update = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
path = [ pkgs.flatpak ];
|
|
script = ''
|
|
flatpak update -y
|
|
'';
|
|
};
|
|
|
|
programs.appimage = {
|
|
enable = true;
|
|
binfmt = true;
|
|
};
|
|
|
|
system.stateVersion = "26.05";
|
|
}
|