nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 bc,
6 curl,
7 figlet,
8 fortune,
9 gawk,
10 iproute2,
11 procps,
12}:
13
14stdenv.mkDerivation {
15 pname = "fancy-motd";
16 version = "0-unstable-2022-06-06";
17
18 src = fetchFromGitHub {
19 owner = "bcyran";
20 repo = "fancy-motd";
21 rev = "812c58f04f65053271f866f3797baa2eba7324f5";
22 sha256 = "sha256-O/euB63Dyj+NyfZK42egSEYwZhL8B0jCxSSDYoT4cpo=";
23 };
24
25 buildInputs = [
26 bc
27 curl
28 figlet
29 fortune
30 gawk
31 iproute2
32 ];
33
34 postPatch = ''
35 substituteInPlace motd.sh \
36 --replace 'BASE_DIR="$(dirname "$(readlink -f "$0")")"' "BASE_DIR=\"$out/lib\""
37
38 substituteInPlace modules/20-uptime \
39 --replace "uptime -p" "${procps}/bin/uptime -p"
40
41 # does not work on nixos
42 rm modules/41-updates
43 '';
44
45 installPhase = ''
46 runHook preInstall
47
48 install -D motd.sh $out/bin/motd
49
50 install -D framework.sh $out/lib/framework.sh
51 install -D config.sh.example $out/lib/config.sh
52 find modules -type f -exec install -D {} $out/lib/{} \;
53
54 runHook postInstall
55 '';
56
57 meta = {
58 description = "Fancy, colorful MOTD written in bash. Server status at a glance";
59 homepage = "https://github.com/bcyran/fancy-motd";
60 license = lib.licenses.mit;
61 maintainers = with lib.maintainers; [ rhoriguchi ];
62 platforms = lib.platforms.linux;
63 mainProgram = "motd";
64 };
65}