services.sshd: fix motd

This commit is contained in:
2025-01-07 13:34:23 +08:00
parent 6c11ecef50
commit 2dafa47ab1
5 changed files with 47 additions and 56 deletions

34
flake.lock generated
View File

@@ -221,6 +221,22 @@
"type": "github" "type": "github"
} }
}, },
"fancy-motd": {
"flake": false,
"locked": {
"lastModified": 1736229030,
"narHash": "sha256-p8roi6VResXridEn2RHjK4KubOQB/nPRP0FmifcvsEI=",
"owner": "CHN-beta",
"repo": "fancy-motd",
"rev": "595993ecd54f1c68b903373a40085e535f5c7493",
"type": "github"
},
"original": {
"owner": "CHN-beta",
"repo": "fancy-motd",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -1185,22 +1201,6 @@
"type": "github" "type": "github"
} }
}, },
"qd": {
"flake": false,
"locked": {
"lastModified": 1452446912,
"narHash": "sha256-ftU28BMGUCq0or0nVkf9fryaLfqGnMonmHu7UuyjMTQ=",
"owner": "scibuilder",
"repo": "QD",
"rev": "a5dbb6136ac1739e7e6955bf7b0c0fa05f3b2cbd",
"type": "github"
},
"original": {
"owner": "scibuilder",
"repo": "QD",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"aagl": "aagl", "aagl": "aagl",
@@ -1214,6 +1214,7 @@
"date": "date", "date": "date",
"eigen": "eigen", "eigen": "eigen",
"envfs": "envfs", "envfs": "envfs",
"fancy-motd": "fancy-motd",
"git-lfs-transfer": "git-lfs-transfer", "git-lfs-transfer": "git-lfs-transfer",
"gricad": "gricad", "gricad": "gricad",
"hextra": "hextra", "hextra": "hextra",
@@ -1242,7 +1243,6 @@
"pocketfft": "pocketfft", "pocketfft": "pocketfft",
"py4vasp": "py4vasp", "py4vasp": "py4vasp",
"qchem": "qchem", "qchem": "qchem",
"qd": "qd",
"rsshub": "rsshub", "rsshub": "rsshub",
"rycee": "rycee", "rycee": "rycee",
"slate": "slate", "slate": "slate",

View File

@@ -69,7 +69,7 @@
ufo = { url = "git+https://git.chn.moe/chn/ufo.git"; flake = false; }; ufo = { url = "git+https://git.chn.moe/chn/ufo.git"; flake = false; };
highfive = { url = "git+https://github.com/CHN-beta/HighFive?submodules=1"; flake = false; }; highfive = { url = "git+https://github.com/CHN-beta/HighFive?submodules=1"; flake = false; };
stickerpicker = { url = "github:maunium/stickerpicker"; flake = false; }; stickerpicker = { url = "github:maunium/stickerpicker"; flake = false; };
qd = { url = "github:scibuilder/QD"; flake = false; }; fancy-motd = { url = "github:CHN-beta/fancy-motd"; flake = false; };
}; };
outputs = inputs: let localLib = import ./flake/lib.nix inputs.nixpkgs.lib; in outputs = inputs: let localLib = import ./flake/lib.nix inputs.nixpkgs.lib; in

View File

@@ -10,7 +10,7 @@ inputs:
[ [
# basic tools # basic tools
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq yq zellij ipfetch localPackages.pslist beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq yq zellij ipfetch localPackages.pslist
fastfetch reptyr duc ncdu progress libva-utils ksh neofetch fastfetch reptyr duc ncdu progress libva-utils ksh neofetch dateutils
# lsxx # lsxx
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc acpica-tools pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc acpica-tools
# top # top

View File

@@ -1,19 +0,0 @@
                   ░▒▓█▓▒░      ░▒▓█▓▒░▒▓███████▓▒░  
                  ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
                 ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
                ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
               ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
              ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
             ░▒▓████████▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░

      ░▒▓██████▓▒░░▒▓███████▓▒░ ░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░  
    ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
   ░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ 
  ░▒▓█▓▒▒▓███▓▒░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░  
 ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░        
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░        
░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓██████▓▒░░▒▓█▓▒░        

               ┌──────────────────────────┐
               │    │
               └──────────────────────────┘

View File

@@ -9,25 +9,35 @@ inputs:
};}); };});
default = null; default = null;
}; };
config = let inherit (inputs.config.nixos.services) sshd; in inputs.lib.mkIf (sshd != null) config = let inherit (inputs.config.nixos.services) sshd; in inputs.lib.mkIf (sshd != null) (inputs.lib.mkMerge
{ [
services.openssh =
{ {
enable = true; services.openssh =
settings =
{ {
X11Forwarding = true; enable = true;
ChallengeResponseAuthentication = false; settings =
PasswordAuthentication = sshd.passwordAuthentication; {
KbdInteractiveAuthentication = false; X11Forwarding = true;
UsePAM = true; ChallengeResponseAuthentication = false;
PasswordAuthentication = sshd.passwordAuthentication;
KbdInteractiveAuthentication = false;
UsePAM = true;
};
}; };
}; nixos.services.xray.client.v2ray-forwarder.noproxyTcpPorts = [ 22 ];
nixos.services.xray.client.v2ray-forwarder.noproxyTcpPorts = [ 22 ]; }
# generate from https://patorjk.com/software/taag with font "BlurVision ASCII" # 如果是服务器,那么启用 motd
# generate using `toilet -f wideterm -F border "InAlGaN / SiC"` (inputs.lib.mkIf (inputs.config.nixos.model.type == "server")
# somehow lolcat could not run with these characters, use rendered directly {
# TODO: move this settings to user nixos =
users.motdFile = inputs.lib.mkIf sshd.groupBanner ./banner-rendered.txt; {
}; packages.packages._packages =
[ (inputs.pkgs.fancy-motd.overrideAttrs { src = inputs.topInputs.fancy-motd; }) ];
user.sharedModules = [(home-inputs: { config.programs.zsh.loginExtra = "motd"; })];
};
# generate from https://patorjk.com/software/taag with font "BlurVision ASCII"
# generate using `toilet -f wideterm -F border "InAlGaN / SiC"`
environment.etc = inputs.lib.mkIf sshd.groupBanner { "fancy-motd/banner".source = ./banner.txt; };
})
]);
} }