From 5853abd2ba484b16dc7fc189364020de250c5fa7 Mon Sep 17 00:00:00 2001 From: Lzebulon Date: Tue, 16 Dec 2025 19:43:00 +0100 Subject: [PATCH 1/3] POC motd --- modules/crans/default.nix | 1 + modules/crans/motd.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 modules/crans/motd.nix diff --git a/modules/crans/default.nix b/modules/crans/default.nix index cac4a63..4d58438 100644 --- a/modules/crans/default.nix +++ b/modules/crans/default.nix @@ -14,6 +14,7 @@ in ./ntp.nix ./restic_client.nix ./monitoring.nix + ./motd.nix ./nullmailer.nix ./packages.nix ./ssh.nix diff --git a/modules/crans/motd.nix b/modules/crans/motd.nix new file mode 100644 index 0000000..cc6cdcd --- /dev/null +++ b/modules/crans/motd.nix @@ -0,0 +1,33 @@ +{ config, lib, ... }: +let + phrase = v: if v.cond then ''[0m> [38;5;82m${v.name}[0m a été déployé sur cette machine. \n'' else ""; + importantPackages = [ + { + name = "Collabora"; + cond = config.services.collabora-online.enable; + } + { + name = "Jitsi"; + cond = config.services.jitsi-meet.enable; + } + { + name = "NextCloud"; + cond = config.services.nextcloud.enable; + } + { + name = "NGINX"; + cond = config.services.nginx.enable; + } + { + name = "Restic (Client)"; + cond = config.crans.resticClient.enable; + } + { + name = "Restic (Server)"; + cond = config.crans.services.resticServer.enable; + } + ]; +in +{ + users.motd = lib.concatStringsSep "\n" (map phrase importantPackages); +} From 8dc41773ae113ada5dfaeecb181190583b4a8a12 Mon Sep 17 00:00:00 2001 From: Lzebulon Date: Wed, 17 Dec 2025 12:41:58 +0100 Subject: [PATCH 2/3] add version nixos --- modules/crans/motd.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/crans/motd.nix b/modules/crans/motd.nix index cc6cdcd..68245ae 100644 --- a/modules/crans/motd.nix +++ b/modules/crans/motd.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let phrase = v: if v.cond then ''[0m> [38;5;82m${v.name}[0m a été déployé sur cette machine. \n'' else ""; importantPackages = [ @@ -29,5 +29,8 @@ let ]; in { - users.motd = lib.concatStringsSep "\n" (map phrase importantPackages); + users.motd = '' + ${config.networking.hostName} utilise NixOS ${lib.version} \n + '' + ++ lib.concatStringsSep "\n" (map phrase importantPackages); } From 898836fed148280ca8681567ff720abc930a5a6e Mon Sep 17 00:00:00 2001 From: Lzebulon Date: Wed, 17 Dec 2025 12:47:58 +0100 Subject: [PATCH 3/3] fix: correct concatenation --- modules/crans/motd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/crans/motd.nix b/modules/crans/motd.nix index 68245ae..6b94b05 100644 --- a/modules/crans/motd.nix +++ b/modules/crans/motd.nix @@ -32,5 +32,5 @@ in users.motd = '' ${config.networking.hostName} utilise NixOS ${lib.version} \n '' - ++ lib.concatStringsSep "\n" (map phrase importantPackages); + + lib.concatStringsSep "\n" (map phrase importantPackages); }