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