From bf2103f9d48a01045c0806b52983a4cad39786f5 Mon Sep 17 00:00:00 2001 From: Pyjacpp Date: Wed, 26 Aug 2026 23:13:19 +0200 Subject: [PATCH] =?UTF-8?q?MOTD=20avec=20version=20de=20la=20flake?= =?UTF-8?q?=E2=80=AF!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/crans/users.nix | 21 ++++++++++++++++++++- modules/default.nix | 5 ++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/modules/crans/users.nix b/modules/crans/users.nix index c229bf4..9c14880 100644 --- a/modules/crans/users.nix +++ b/modules/crans/users.nix @@ -1,4 +1,9 @@ -{ config, lib, ... }: +{ + config, + lib, + self, + ... +}: let cfg = config.crans.users; @@ -34,6 +39,20 @@ in users = { mutableUsers = false; + motd = + let + shortRev = self.shortRev or self.dirtyShortRev or "inconnue"; + rev = self.rev or (lib.strings.removeSuffix "-dirty" (self.dirtyRev or "inconnue")); + isDirty = !(self ? rev); + in + '' + ${ + if isDirty then "!! DIRTY !! " else "" + }Version déployée ${shortRev}, modifiée le ${self.lastModifiedDate or "??"}. + + https://gitlab.crans.org/nounous/nixos/-/commit/${rev} + ''; + users.root = { hashedPasswordFile = config.age.secrets.root-passwd-hash.path; }; diff --git a/modules/default.nix b/modules/default.nix index be2ac91..9685e31 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ lib, self, ... }: { imports = [ @@ -25,6 +25,9 @@ cleanOnBoot = true; }; + # Version de la flake pour nixos-version --configuration-revision + system.configurationRevision = self.rev or self.dirtyRev or "inconnue"; + # Recommandé depuis le passage à 26.05 boot.zfs.forceImportAll = lib.mkDefault false; boot.zfs.forceImportRoot = lib.mkDefault false;