From b5b56d4f82b87ae7ed072fc7f9c85125c76aa2b9 Mon Sep 17 00:00:00 2001 From: ene Date: Tue, 17 Jan 2023 08:34:49 +0100 Subject: Feat: Added a nice motd through rust-motd I'm not sure if this is really helpful --- services/rust-motd.nix | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 services/rust-motd.nix (limited to 'services') diff --git a/services/rust-motd.nix b/services/rust-motd.nix new file mode 100644 index 0000000..365958e --- /dev/null +++ b/services/rust-motd.nix @@ -0,0 +1,65 @@ +{ config, pkgs, ... }: { + progams.rust-motd = { + enable = true; + enableMotdInSSHD = true; + refreshInterval = + "*:0/5"; # 0/5 means: hour 0 AND all hour wich match (0 + 5 * x) (is the same as: 0, 5, 10, 15, 20) + settings = '' + [global] + progress_full_character = "=" + progress_empty_character = "-" + progress_prefix = "[" + progress_suffix = "]" + time_format = "%Y-%m-%d %H:%M:%S" + + # [banner] + # color = "red" + command = "${pkgs.hostname} | ${pkgs.figlet} -f slant" + # if you don't want a dependency on figlet, you can generate your + # banner however you want, put it in a file, and then use something like: + # command = "cat banner.txt" + + # [weather] + # url = "https://wttr.in/New+York,New+York?0" + # proxy = "http://proxy:8080" + + # [service_status] + # Accounts = "accounts-daemon" + # Cron = "cron" + + [docker_status] + # Local containers MUST start with a slash + # https://github.com/moby/moby/issues/6705 + #"/nextcloud-nextcloud-1" = "Nextcloud" + #"/nextcloud-nextcloud-mariadb-1" = "Nextcloud Database" + + # [uptime] + prefix = "Uptime:" + + # [user_service_status] + # gpg-agent = "gpg-agent" + + # [ssl_certificates] + # sort_method = "manual" + # + # [ssl_certificates.certs] + # CertName1 = "/path/to/cert1.pem" + # CertName2 = "/path/to/cert2.pem" + + # [filesystems] + # root = "/" + + [memory] + swap_pos = "beside" # or "below" or "none" + + [fail_2_ban] + jails = ["sshd"] #, "anotherjail"] + + # [last_login] + # sally = 2 + # jimmy = 1 + + [last_run] + ''; + }; +} -- cgit 1.4.1 From a1166786c73fc1609c96a1eb27794c3641705ccd Mon Sep 17 00:00:00 2001 From: ene Date: Tue, 17 Jan 2023 08:44:06 +0100 Subject: Fix: typo in programs field --- services/rust-motd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'services') diff --git a/services/rust-motd.nix b/services/rust-motd.nix index 365958e..9c2c23e 100644 --- a/services/rust-motd.nix +++ b/services/rust-motd.nix @@ -1,5 +1,5 @@ { config, pkgs, ... }: { - progams.rust-motd = { + programs.rust-motd = { enable = true; enableMotdInSSHD = true; refreshInterval = -- cgit 1.4.1 From 6ab5e738f391b8dbdd5108c1733f90707626c11f Mon Sep 17 00:00:00 2001 From: ene Date: Tue, 17 Jan 2023 09:04:20 +0100 Subject: Fix: changed to TOML config This module generates a TOML config from a nix set. --- services/rust-motd.nix | 54 ++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'services') diff --git a/services/rust-motd.nix b/services/rust-motd.nix index 9c2c23e..62b2188 100644 --- a/services/rust-motd.nix +++ b/services/rust-motd.nix @@ -4,20 +4,22 @@ enableMotdInSSHD = true; refreshInterval = "*:0/5"; # 0/5 means: hour 0 AND all hour wich match (0 + 5 * x) (is the same as: 0, 5, 10, 15, 20) - settings = '' - [global] - progress_full_character = "=" - progress_empty_character = "-" - progress_prefix = "[" - progress_suffix = "]" - time_format = "%Y-%m-%d %H:%M:%S" + settings = { + global = { + progress_full_character = "="; + progress_empty_character = "-"; + progress_prefix = "["; + progress_suffix = "]"; + time_format = "%Y-%m-%d %H:%M:%S"; + }; - # [banner] + banner = { # color = "red" - command = "${pkgs.hostname} | ${pkgs.figlet} -f slant" + command = "${pkgs.hostname} | ${pkgs.figlet} -f slant"; # if you don't want a dependency on figlet, you can generate your # banner however you want, put it in a file, and then use something like: # command = "cat banner.txt" + }; # [weather] # url = "https://wttr.in/New+York,New+York?0" @@ -27,39 +29,43 @@ # Accounts = "accounts-daemon" # Cron = "cron" - [docker_status] + # [docker_status] # Local containers MUST start with a slash # https://github.com/moby/moby/issues/6705 #"/nextcloud-nextcloud-1" = "Nextcloud" #"/nextcloud-nextcloud-mariadb-1" = "Nextcloud Database" - # [uptime] - prefix = "Uptime:" + uptime = { + prefix = "Uptime:"; + }; # [user_service_status] # gpg-agent = "gpg-agent" - # [ssl_certificates] - # sort_method = "manual" - # - # [ssl_certificates.certs] - # CertName1 = "/path/to/cert1.pem" - # CertName2 = "/path/to/cert2.pem" + ssl_certificates = { + # sort_method = "manual" + # + # [ssl_certificates.certs] + # CertName1 = "/path/to/cert1.pem" + # CertName2 = "/path/to/cert2.pem" + }; # [filesystems] # root = "/" - [memory] - swap_pos = "beside" # or "below" or "none" + memory = { + swap_pos = "beside"; # or "below" or "none" + }; - [fail_2_ban] - jails = ["sshd"] #, "anotherjail"] + fail_2_ban = { + jails = ["sshd"]; #, "anotherjail"] + }; # [last_login] # sally = 2 # jimmy = 1 - [last_run] - ''; + last_run = true; + }; }; } -- cgit 1.4.1 From 977f8c1bfc784df037f6ad536b65ead6e3a13503 Mon Sep 17 00:00:00 2001 From: ene Date: Tue, 17 Jan 2023 20:44:01 +0100 Subject: Fix: Changed setting names The names of the settings in the GitHub repository are outdated, this commit changes the setting name to the real ones. --- services/rust-motd.nix | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'services') diff --git a/services/rust-motd.nix b/services/rust-motd.nix index 62b2188..6ff9367 100644 --- a/services/rust-motd.nix +++ b/services/rust-motd.nix @@ -1,9 +1,12 @@ -{ config, pkgs, ... }: { +{ + config, + pkgs, + ... +}: { programs.rust-motd = { enable = true; enableMotdInSSHD = true; - refreshInterval = - "*:0/5"; # 0/5 means: hour 0 AND all hour wich match (0 + 5 * x) (is the same as: 0, 5, 10, 15, 20) + refreshInterval = "*:0/5"; # 0/5 means: hour 0 AND all hour wich match (0 + 5 * x) (is the same as: 0, 5, 10, 15, 20) settings = { global = { progress_full_character = "="; @@ -14,11 +17,11 @@ }; banner = { - # color = "red" - command = "${pkgs.hostname} | ${pkgs.figlet} -f slant"; - # if you don't want a dependency on figlet, you can generate your - # banner however you want, put it in a file, and then use something like: - # command = "cat banner.txt" + color = "red"; + command = "${pkgs.hostname}/bin/hostname | ${pkgs.figlet}/bin/figlet -f slant"; + # if you don't want a dependency on figlet, you can generate your + # banner however you want, put it in a file, and then use something like: + # command = "cat banner.txt" }; # [weather] @@ -42,30 +45,32 @@ # [user_service_status] # gpg-agent = "gpg-agent" - ssl_certificates = { - # sort_method = "manual" - # - # [ssl_certificates.certs] - # CertName1 = "/path/to/cert1.pem" - # CertName2 = "/path/to/cert2.pem" - }; + #s_s_l_certs = { + # sort_method = "manual" + # + # certs = { + # CertName1 = "/path/to/cert1.pem" + # CertName2 = "/path/to/cert2.pem" + # } + #}; - # [filesystems] - # root = "/" + filesystems = { + root = "/"; + }; memory = { swap_pos = "beside"; # or "below" or "none" }; - fail_2_ban = { + fail2_ban = { jails = ["sshd"]; #, "anotherjail"] }; - # [last_login] - # sally = 2 - # jimmy = 1 + last_login = { + }; - last_run = true; + last_run = { + }; }; }; } -- cgit 1.4.1