Compare commits

...

1 Commits

Author SHA1 Message Date
chn
2dafa47ab1 services.sshd: fix motd 2025-01-07 13:51:51 +08:00
5 changed files with 47 additions and 56 deletions

34
flake.lock generated
View File

@@ -221,6 +221,22 @@
"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": false,
"locked": {
@@ -1185,22 +1201,6 @@
"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": {
"inputs": {
"aagl": "aagl",
@@ -1214,6 +1214,7 @@
"date": "date",
"eigen": "eigen",
"envfs": "envfs",
"fancy-motd": "fancy-motd",
"git-lfs-transfer": "git-lfs-transfer",
"gricad": "gricad",
"hextra": "hextra",
@@ -1242,7 +1243,6 @@
"pocketfft": "pocketfft",
"py4vasp": "py4vasp",
"qchem": "qchem",
"qd": "qd",
"rsshub": "rsshub",
"rycee": "rycee",
"slate": "slate",

View File

@@ -69,7 +69,7 @@
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; };
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

View File

@@ -10,7 +10,7 @@ inputs:
[
# basic tools
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
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc acpica-tools
# top

View File

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

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

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

View File

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