modules/motd: init

This commit is contained in:
Max Headroom 2022-05-17 00:02:24 +02:00
parent 256118c2b4
commit e28e0266a3
3 changed files with 50 additions and 0 deletions

View file

@ -12,6 +12,7 @@ let
ipfs = import ./ipfs; ipfs = import ./ipfs;
maintenance = import ./maintenance; maintenance = import ./maintenance;
monitoring = import ./monitoring; monitoring = import ./monitoring;
motd = import ./motd;
nix-builder = import ./nix-builder; nix-builder = import ./nix-builder;
nix-config = import ./nix-config; nix-config = import ./nix-config;
nix-config-server = import ./nix-config/server.nix; nix-config-server = import ./nix-config/server.nix;
@ -29,6 +30,7 @@ in rec {
autopatch autopatch
enterprise enterprise
maintenance maintenance
motd
]; ];
networking = [ networking = [

41
modules/motd/default.nix Normal file
View file

@ -0,0 +1,41 @@
{ config, inputs, pkgs, ... }:
{
users.motd = builtins.readFile ./motd.txt;
environment.interactiveShellInit = ''
(
# Reset colors
CO='\033[0m'
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[0;37m'
# Bold colors
BBLACK='\033[1;30m'
BRED='\033[1;31m'
BGREEN='\033[1;32m'
BYELLOW='\033[1;33m'
BBLUE='\033[1;34m'
BPURPLE='\033[1;35m'
BCYAN='\033[1;36m'
BWHITE='\033[1;37m'
# Color accent to use in any primary text
CA=$PURPLE
CAB=$BPURPLE
echo
echo -e " ''${BGREEN}()''${CO} ''${BWHITE}You are using a genuine Private Void system.''${CO}"
echo " "
echo -e " ''${BWHITE}OS Version....:''${CO} NixOS ''${CAB}${config.system.nixos.version}''${CO}"
echo -e " ''${BWHITE}Configuration.:''${CO} ''${CAB}${inputs.self.rev or "\${BRED}()\${CO}\${BWHITE} Dirty"}''${CO}"
echo -e " ''${BWHITE}Uptime........:''${CO} ''${CAB}$(${pkgs.procps}/bin/uptime -p | cut -d ' ' -f2-)''${CO}"
echo -e " ''${BWHITE}SSH Logins....:''${CO} There are currently ''${CAB}$(${pkgs.coreutils}/bin/who | ${pkgs.coreutils}/bin/wc -l)''${CO} users logged in"
)
'';
}

7
modules/motd/motd.txt Normal file
View file

@ -0,0 +1,7 @@
___ _ __ _ __ _ __
/ _ \____(_) _____ _/ /____ | | / /__ (_)__/ /
/ ___/ __/ / |/ / _ `/ __/ -_) | |/ / _ \/ / _ /
/_/ /_/ /_/|___/\_,_/\__/\__/ |___/\___/_/\_,_/