diff --git a/flake.lock b/flake.lock index 24227e22..c512c45c 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/flake.nix b/flake.nix index c699b6f6..aa3d2fd7 100644 --- a/flake.nix +++ b/flake.nix @@ -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 diff --git a/modules/packages/server.nix b/modules/packages/server.nix index 2b6c9e69..c8abacae 100644 --- a/modules/packages/server.nix +++ b/modules/packages/server.nix @@ -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 diff --git a/modules/services/sshd/banner-rendered.txt b/modules/services/sshd/banner-rendered.txt deleted file mode 100644 index e41a96c7..00000000 --- a/modules/services/sshd/banner-rendered.txt +++ /dev/null @@ -1,19 +0,0 @@ -                   ░▒▓█▓▒░      ░▒▓█▓▒░▒▓███████▓▒░   -                  ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -                 ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -                ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -               ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -              ░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -             ░▒▓████████▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ - -      ░▒▓██████▓▒░░▒▓███████▓▒░ ░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░   -    ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -   ░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░  -  ░▒▓█▓▒▒▓███▓▒░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░   - ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░         -░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░         -░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓██████▓▒░░▒▓█▓▒░         - -               ┌──────────────────────────┐ -               │InAlGaN  /  SiC│ -               └──────────────────────────┘ diff --git a/modules/services/sshd/default.nix b/modules/services/sshd/default.nix index 864a2b73..53399f46 100644 --- a/modules/services/sshd/default.nix +++ b/modules/services/sshd/default.nix @@ -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; }; + }) + ]); }