diff options
| author | Mel <einebeere@gmail.com> | 2024-03-02 18:47:17 +0000 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-03-02 18:47:17 +0000 |
| commit | b76ad56fc98a03514fa897de6ed72d97a3f7b465 (patch) | |
| tree | b49050b1d2a2f2f0aaf26d47be5ad8ef6bb9420d | |
| parent | 4e29b3423a1c56ba665c66124994178aae58d0d1 (diff) | |
| download | rnrd-b76ad56fc98a03514fa897de6ed72d97a3f7b465.tar.zst rnrd-b76ad56fc98a03514fa897de6ed72d97a3f7b465.zip | |
MOTD on SSH login
| -rw-r--r-- | configuration.nix | 21 | ||||
| -rw-r--r-- | me.nix | 4 | ||||
| -rw-r--r-- | util.nix | 13 |
3 files changed, 30 insertions, 8 deletions
diff --git a/configuration.nix b/configuration.nix index 81df308..bf8b46c 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,9 +1,9 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: let - util = import ./util.nix; + util = import ./util.nix { inherit lib; }; - me = import ./me.nix { inherit util; }; + me = util.checkMe (import ./me.nix); security = import ./security.nix; in { @@ -33,6 +33,14 @@ in hashedPassword = security.password; }; + users.motd = '' + +/^ /^ +\ ' ' 7 < Hi, I'm ${util.titleCase me.name} +/ \ + + ''; + networking = { hostName = me.name; @@ -85,7 +93,12 @@ in vimrcFile = ./configs/.vimrc; }; }; - fish.enable = true; + fish = { + enable = true; + interactiveShellInit = '' + set fish_greeting + ''; + }; git.enable = true; tmux.enable = true; }; diff --git a/me.nix b/me.nix index 7f088d3..e4e8cfa 100644 --- a/me.nix +++ b/me.nix @@ -1,3 +1,3 @@ -{ util, ... }: util.mkMe { +{ name = ""; # Enter machine name here -} \ No newline at end of file +} diff --git a/util.nix b/util.nix index 86fe375..1375ef5 100644 --- a/util.nix +++ b/util.nix @@ -1,5 +1,14 @@ +{ lib }: { - mkMe = { name ? "", ... }@me: + checkMe = { name ? "", ... }@me: assert name != ""; + assert (builtins.pathExists ./machines/${name}.nix) + && (builtins.pathExists ./hardware/${name}.nix); me; -} \ No newline at end of file + + titleCase = str: with lib.strings; let + firstCharUpper = s: concatStrings [(toUpper (substring 0 1 s)) (substring 1 (stringLength s) s)]; + in + concatStringsSep " " (map firstCharUpper (splitString " " str)); + +} |
