about summary refs log tree commit diff
path: root/pkgs/tools/system
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-05-17 02:34:29 +0200
committerGitHub <noreply@github.com>2021-05-17 02:34:29 +0200
commit63365ac57cd496787f8d99c191266c84dbc838ea (patch)
treec17c0c7d39e2c01ec4660d42664ec920d62f7db3 /pkgs/tools/system
parent6e80cf82383951a22ef78ba1daafbce9825eb33f (diff)
parentdb8a884d4b7948ee2b03db702722d8b2879f592b (diff)
downloadnixlib-63365ac57cd496787f8d99c191266c84dbc838ea.tar
nixlib-63365ac57cd496787f8d99c191266c84dbc838ea.tar.gz
nixlib-63365ac57cd496787f8d99c191266c84dbc838ea.tar.bz2
nixlib-63365ac57cd496787f8d99c191266c84dbc838ea.tar.lz
nixlib-63365ac57cd496787f8d99c191266c84dbc838ea.tar.xz
nixlib-63365ac57cd496787f8d99c191266c84dbc838ea.tar.zst
nixlib-63365ac57cd496787f8d99c191266c84dbc838ea.zip
Merge pull request #122885 from rhoriguchi/fancy-motd
fancy-motd: init at unstable-2021-05-15
Diffstat (limited to 'pkgs/tools/system')
-rw-r--r--pkgs/tools/system/fancy-motd/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/tools/system/fancy-motd/default.nix b/pkgs/tools/system/fancy-motd/default.nix
new file mode 100644
index 000000000000..982dbcd2f5b1
--- /dev/null
+++ b/pkgs/tools/system/fancy-motd/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, lib, fetchFromGitHub, bc, curl, figlet, fortune, gawk, iproute2, procps }:
+
+stdenv.mkDerivation rec {
+  pname = "fancy-motd";
+  version = "unstable-2021-05-15";
+
+  src = fetchFromGitHub {
+    owner = "bcyran";
+    repo = pname;
+    rev = "b25c1e7d76927d7f947a048d844dad4400de3598";
+    sha256 = "05jazmijk3im1wl4nprkwmrq6bxhb3ah8syyqym109blajy72841";
+  };
+
+  buildInputs = [ bc curl figlet fortune gawk iproute2 ];
+
+  postPatch = ''
+    substituteInPlace motd.sh \
+      --replace 'BASE_DIR="$(dirname "$(readlink -f "$0")")"' "BASE_DIR=\"$out/lib\""
+
+    substituteInPlace modules/20-uptime \
+      --replace "uptime -p" "${procps}/bin/uptime -p"
+
+    # does not work on nixos
+    rm modules/41-updates
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D motd.sh $out/bin/motd
+
+    install -D framework.sh $out/lib/framework.sh
+    install -D config.sh.example $out/lib/config.sh
+    find modules -type f -exec install -D {} $out/lib/{} \;
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Fancy, colorful MOTD written in bash. Server status at a glance.";
+    homepage = "https://github.com/bcyran/fancy-motd";
+    license = licenses.mit;
+    maintainers = with maintainers; [ rhoriguchi ];
+    platforms = platforms.linux;
+    mainProgram = "motd";
+  };
+}