Kieran's opinionated (and probably slightly dumb) nix config
1{ pkgs, lib, stdenv, fetchurl, autoPatchelfHook }:
2
3stdenv.mkDerivation rec {
4 pname = "zmx";
5 version = "0.1.0";
6
7 src = fetchurl {
8 url = if stdenv.isLinux then
9 (if stdenv.isAarch64 then
10 "https://zmx.sh/a/zmx-${version}-linux-aarch64.tar.gz"
11 else
12 "https://zmx.sh/a/zmx-${version}-linux-x86_64.tar.gz")
13 else if stdenv.isDarwin then
14 (if stdenv.isAarch64 then
15 "https://zmx.sh/a/zmx-${version}-macos-aarch64.tar.gz"
16 else
17 "https://zmx.sh/a/zmx-${version}-macos-x86_64.tar.gz")
18 else throw "Unsupported platform";
19
20 hash = if stdenv.isLinux && stdenv.isAarch64 then
21 "sha256-cMGo+Af0VRY3c2EoNzVZFU53Kz5wKL8zsSSXIOtZVU8="
22 else if stdenv.isLinux then
23 "sha256-Zmqs/Y3be2z9KMuSwyTLZWKbIInzHgoC9Bm0S2jv3XI="
24 else if stdenv.isDarwin && stdenv.isAarch64 then
25 "sha256-34k5Q1cIr3+foubtMJVoHVHZtCLoSjwJK00e1p0JdLg="
26 else
27 "sha256-0epjoQhUSBYlE0L7Ubwn/sJF61+4BbxeaRx6EY/SklE=";
28 };
29
30 nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
31
32 sourceRoot = ".";
33
34 installPhase = ''
35 runHook preInstall
36 mkdir -p $out/bin
37 cp zmx $out/bin/
38 chmod +x $out/bin/zmx
39 runHook postInstall
40 '';
41
42 meta = with lib; {
43 description = "Session persistence for terminal processes";
44 homepage = "https://zmx.sh";
45 license = licenses.mit;
46 platforms = platforms.unix;
47 };
48}