diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-08 10:26:42 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-23 18:27:31 +0200 |
commit | aebf74e015a159dbbcfa44c0378cbb2279effae0 (patch) | |
tree | 537a0877717ab525f2eea575b15177a382c2c11f /modules/by-name/ru/rust-motd/module.nix | |
parent | modules/users: change sils sshkey (diff) | |
download | nixos-server-aebf74e015a159dbbcfa44c0378cbb2279effae0.zip |
modules/rust-motd: Generate the banner ahead of time
Diffstat (limited to '')
-rw-r--r-- | modules/by-name/ru/rust-motd/module.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/by-name/ru/rust-motd/module.nix b/modules/by-name/ru/rust-motd/module.nix index a6998f4..7f3b44f 100644 --- a/modules/by-name/ru/rust-motd/module.nix +++ b/modules/by-name/ru/rust-motd/module.nix @@ -19,6 +19,13 @@ || v.openssh.authorizedKeys.keyFiles != [] ); userList = builtins.mapAttrs (n: v: 2) (lib.filterAttrs pred config.users.users); + + bannerFile = + pkgs.runCommandNoCCLocal "banner-file" { + nativeBuildInputs = [pkgs.figlet]; + } '' + echo "${config.system.name}" | figlet -f slant > "$out" + ''; in { options.vhack.rust-motd = { enable = lib.mkEnableOption "rust-motd"; @@ -49,10 +56,8 @@ in { banner = { 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" + # Avoid some runtime dependencies. + command = "cat ${bannerFile}"; }; uptime = { |