From e1ee83f6b9586ec76f47e139ec0196e763990f51 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 13 May 2025 09:30:40 -0500 Subject: [PATCH] Update pins, add zed-bin zed-bin still doesn't show the UI, but this is at least one attempt Update flake inputs --- flake.lock | 138 +++++++++++++++++++++++------------------ pkgs/default.nix | 1 + pkgs/zed-bin.nix | 156 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 234 insertions(+), 61 deletions(-) create mode 100644 pkgs/zed-bin.nix diff --git a/flake.lock b/flake.lock index e2834e9..023e19f 100644 --- a/flake.lock +++ b/flake.lock @@ -10,11 +10,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1736955230, - "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", + "lastModified": 1745630506, + "narHash": "sha256-bHCFgGeu8XjWlVuaWzi3QONjDW3coZDqSHvnd4l7xus=", "owner": "ryantm", "repo": "agenix", - "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", + "rev": "96e078c646b711aee04b82ba01aefbff87004ded", "type": "github" }, "original": { @@ -31,11 +31,11 @@ "nixpkgs-unstable": "nixpkgs-unstable" }, "locked": { - "lastModified": 1743155549, - "narHash": "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto=", + "lastModified": 1746800328, + "narHash": "sha256-zPum6QW2wYqSJNO+wEPKQdWD1Rt3SM9ir0YfGOVqReo=", "owner": "fort-nix", "repo": "nix-bitcoin", - "rev": "990805aa7c7fcd1552c6e14e8c6df9a88ba9be41", + "rev": "b2bc5e6e7553954374593f6527e43828e7302b52", "type": "github" }, "original": { @@ -72,11 +72,11 @@ ] }, "locked": { - "lastModified": 1700795494, - "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "lastModified": 1744478979, + "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "rev": "43975d782b418ebf4969e9ccba82466728c2851b", "type": "github" }, "original": { @@ -93,11 +93,11 @@ ] }, "locked": { - "lastModified": 1744224272, - "narHash": "sha256-cqePj5nuC7flJWNncaVAFq1YZncU0PSyO0DEqGn+vYc=", + "lastModified": 1747069642, + "narHash": "sha256-a4TdGi/Ju8P3r5OIecNfM3LH3kccMY0dIo+EwiyphmM=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "113883e37d985d26ecb65282766e5719f2539103", + "rev": "d642c9856003ed37ce34dab618abf37e3ade1061", "type": "github" }, "original": { @@ -294,7 +294,7 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_5" + "systems": "systems_6" }, "locked": { "lastModified": 1710146030, @@ -338,11 +338,11 @@ ] }, "locked": { - "lastModified": 1744307861, - "narHash": "sha256-c4i69OsEMi3e5+HuWrwgcx9sOsn1Z1hxLlyiQOiWJi8=", + "lastModified": 1747081732, + "narHash": "sha256-VnR33UmH0KzvTuVg+6oYkDVpnPuHanQisNUXytCRBPQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "140a7df916f6257c755b8663fb27ed79e81c8e89", + "rev": "f0a7db5ec1d369721e770a45e4d19f8e48186a69", "type": "github" }, "original": { @@ -360,11 +360,11 @@ ] }, "locked": { - "lastModified": 1703113217, - "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "lastModified": 1745494811, + "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", "owner": "nix-community", "repo": "home-manager", - "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", "type": "github" }, "original": { @@ -380,11 +380,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1742649964, - "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "lastModified": 1746537231, + "narHash": "sha256-Wb2xeSyOsCoTCTj7LOoD6cdKLEROyFAArnYoS+noCWo=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "rev": "fa466640195d38ec97cf0493d6d6882bc4d14969", "type": "github" }, "original": { @@ -407,27 +407,27 @@ ] }, "locked": { - "lastModified": 1729958008, - "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "lastModified": 1737371634, + "narHash": "sha256-fTVAWzT1UMm1lT+YxHuVPtH+DATrhYfea3B0MxG/cGw=", "owner": "NuschtOS", "repo": "ixx", - "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "rev": "a1176e2a10ce745ff8f63e4af124ece8fe0b1648", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.0.6", + "ref": "v0.0.7", "repo": "ixx", "type": "github" } }, "nix-hardware": { "locked": { - "lastModified": 1746814339, - "narHash": "sha256-hf2lICJzwACWuzHCmZn5NI6LUAOgGdR1yh8ip+duyhk=", + "lastModified": 1747083103, + "narHash": "sha256-dMx20S2molwqJxbmMB4pGjNfgp5H1IOHNa1Eby6xL+0=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "3c5e12673265dfb0de3d9121420c0c2153bf21e0", + "rev": "d1d68fe8b00248caaa5b3bbe4984c12b47e0867d", "type": "github" }, "original": { @@ -474,11 +474,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742937945, - "narHash": "sha256-lWc+79eZRyvHp/SqMhHTMzZVhpxkRvthsP1Qx6UCq0E=", + "lastModified": 1746422338, + "narHash": "sha256-NTtKOTLQv6dPfRe00OGSywg37A1FYqldS6xiNmqBUYc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7", + "rev": "5b35d248e9206c1f3baf8de6a7683fee126364aa", "type": "github" }, "original": { @@ -520,11 +520,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1742923925, - "narHash": "sha256-biPjLws6FiBVUUDHEMFq5pUQL84Wf7PntPYdo3oKkFw=", + "lastModified": 1746332716, + "narHash": "sha256-VBmKSkmw9PYBCEGhBKzORjx+nwNZkPZyHcUHE21A/ws=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "25d1b84f5c90632a623c48d83a2faf156451e6b1", + "rev": "6b1c028bce9c89e9824cde040d6986d428296055", "type": "github" }, "original": { @@ -567,11 +567,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1744157173, - "narHash": "sha256-bWSjxDwq7iVePrhmA7tY2dyMWHuNJo8knkO4y+q4ZkY=", + "lastModified": 1746576598, + "narHash": "sha256-FshoQvr6Aor5SnORVvh/ZdJ1Sa2U4ZrIMwKBX5k2wu0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6a39c6e495eefabc935d8ddf66aa45d85b85fa3f", + "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55", "type": "github" }, "original": { @@ -583,11 +583,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1744098102, - "narHash": "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA=", + "lastModified": 1746904237, + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7", + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", "type": "github" }, "original": { @@ -631,11 +631,11 @@ }, "nixunstable": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1746904237, + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", "type": "github" }, "original": { @@ -649,14 +649,15 @@ "inputs": { "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_3", - "nuschtosSearch": "nuschtosSearch" + "nuschtosSearch": "nuschtosSearch", + "systems": "systems_4" }, "locked": { - "lastModified": 1744272522, - "narHash": "sha256-cFuxYOLp/6L0eu5wX7xmaF4VhqEm/aT08awzEHGMMQE=", + "lastModified": 1747083534, + "narHash": "sha256-r88FEbKX1HLTovPFt1QHxzZDV7D4TGHhYlJcHmK7hYk=", "owner": "nix-community", "repo": "nixvim", - "rev": "33c3f98fdc9a62183ec7d535bf910e04f141284b", + "rev": "ff0ccdf572ad6700a2a29a82cc5d17db29708988", "type": "github" }, "original": { @@ -673,11 +674,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1744314299, - "narHash": "sha256-nGLdoxJ03zMRlYHgaXSl7+DJwe00eb+O8yegHdR0GME=", + "lastModified": 1747101439, + "narHash": "sha256-MuIpaLHhP8kd5ipTduacEVmTOxqViLIPgplVnz6RtAo=", "owner": "nix-community", "repo": "NUR", - "rev": "236a5db5f1885eb1acb5eb83f2412a72ee10c5ba", + "rev": "f0fbbeb711c0e56d2cdf58388e633b2aea1d45e2", "type": "github" }, "original": { @@ -696,11 +697,11 @@ ] }, "locked": { - "lastModified": 1743683223, - "narHash": "sha256-LdXtHFvhEC3S64dphap1pkkzwjErbW65eH1VRerCUT0=", + "lastModified": 1745046075, + "narHash": "sha256-8v4y6k16Ra/fiecb4DxhsoOGtzLKgKlS+9/XJ9z0T2I=", "owner": "NuschtOS", "repo": "search", - "rev": "56a49ffef2908dad1e9a8adef1f18802bc760962", + "rev": "066afe8643274470f4a294442aadd988356a478f", "type": "github" }, "original": { @@ -718,11 +719,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1743764738, - "narHash": "sha256-YYbR1o5qTPUxpaVhkJcOGjghNGbIBQmivXAgNTFDxqU=", + "lastModified": 1746882493, + "narHash": "sha256-KbkIGJ6fe5F6AZRCzrNH3vNAnbbt+gf/PWrfMZ/B0As=", "owner": "SaumonNet", "repo": "proxmox-nixos", - "rev": "91c96a414e14835b84adbf775f793739a5851fab", + "rev": "bda8df28b6656843e459f166b04bc291bc495a29", "type": "github" }, "original": { @@ -824,6 +825,21 @@ "type": "github" } }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -847,7 +863,7 @@ }, "utils": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1710146030, @@ -892,11 +908,11 @@ ] }, "locked": { - "lastModified": 1744290088, - "narHash": "sha256-/X9XVEl0EiyisNbF5srrxXRSVoRqdwExuqyspYqqEjQ=", + "lastModified": 1746453552, + "narHash": "sha256-r66UGha+7KVHkI7ksrcMjnw/mm9Sg4l5bQlylxHwdGU=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "60b4904a1390ac4c89e93d95f6ed928975e525ed", + "rev": "be618645aa0adf461f778500172b6896d5ab2d01", "type": "github" }, "original": { diff --git a/pkgs/default.nix b/pkgs/default.nix index 2e2bf19..d939d06 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -20,4 +20,5 @@ in vfio_startup = c ./vfio_startup.nix { }; vfio_shutdown = c ./vfio_shutdown.nix { }; zim = c ./zim.nix { }; + zed-bin = c ./zed-bin.nix { }; } diff --git a/pkgs/zed-bin.nix b/pkgs/zed-bin.nix new file mode 100644 index 0000000..94821ea --- /dev/null +++ b/pkgs/zed-bin.nix @@ -0,0 +1,156 @@ +# default.nix or zed-bin.nix +{ + lib, + stdenv, + fetchurl, + autoPatchelfHook, + makeWrapper, + # Runtime dependencies for Zed Editor + alsa-lib, + dbus, + fontconfig, + freetype, + glib, + gtk3, + libglvnd, + libxkbcommon, + openssl, + pipewire, + systemd, + vulkan-loader, + wayland, + wayland-protocols, + wayland-scanner, + xorg, + # For the update script + writeScriptBin, +}: + +stdenv.mkDerivation rec { + pname = "zed-bin"; + version = "0.185.16"; + + # Fetch the pre-built binary tarball from GitHub releases + src = fetchurl { + url = "https://github.com/zed-industries/zed/releases/download/v${version}/zed-linux-x86_64.tar.gz"; + hash = "sha256-gbtkMBaeWg84P9DFOMu/c9r1KOcTITI6vPYja2vy9rw="; + }; + + # Tools needed during the build/installation phase + nativeBuildInputs = [ + autoPatchelfHook # Automatically patches ELF binaries + makeWrapper # To wrap the executable if needed + ]; + + # Runtime dependencies required by the Zed binary + # autoPatchelfHook finds many, but explicit listing improves robustness + buildInputs = [ + alsa-lib # Audio support + dbus # D-Bus message bus system + fontconfig # Font configuration and customization library + freetype # Font rendering engine + glib # Low-level core library + gtk3 # Toolkit for creating graphical user interfaces (often used for file pickers) + libglvnd # Vendor-neutral GL dispatch library + libxkbcommon # Keyboard handling library + openssl # Cryptography library + pipewire # Graph based processing engine for audio and video + stdenv.cc.cc.lib # Standard C++ library (libstdc++) + systemd # System and service manager (for login sessions, dbus activation) + vulkan-loader # Vulkan ICD loader + wayland # Wayland display server protocol + wayland-protocols # Wayland protocols definitions + wayland-scanner # Wayland scanner utility + # Xorg libraries for X11 support + xorg.libX11 + xorg.libXcursor + xorg.libXfixes + xorg.libXi + xorg.libXrandr + xorg.libXrender + xorg.libXScrnSaver + xorg.libXtst + ]; + + # The tarball contains the 'zed' executable directly at the root + # No sourceRoot needed + + installPhase = '' + runHook preInstall + + # Create the bin directory in the output path + mkdir -p $out/bin + + # Copy the executable to the output bin directory + cp -r bin lib libexec share $out/ + + # Ensure the executable has execute permissions + chmod +x $out/bin/zed + + # Wrap the program (optional but good practice) + # Example: Ensure dbus tools are available in PATH if needed by Zed internally + # You might need to add more paths depending on Zed's runtime requirements + wrapProgram $out/bin/zed --prefix PATH : ${lib.makeBinPath [ dbus ]} + + runHook postInstall + ''; + + # Passthru attribute containing a script to update the package version and hash + passthru.updateScript = writeScriptBin "update-${pname}" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl jq nix-update nix-prefetch-scripts git + + set -euo pipefail # Exit on error, unset variable, or pipe failure + + # Get the latest release tag name from GitHub API + # Fetches the latest release (not pre-release) + latest_tag=$(curl -s "https://api.github.com/repos/zed-industries/zed/releases/latest" | jq -r '.tag_name') + if [[ -z "$latest_tag" ]]; then + echo "Failed to fetch latest tag from GitHub API" >&2 + exit 1 + fi + # Remove the 'v' prefix if it exists (e.g., v0.185.16 -> 0.185.16) + latest_version="''${latest_tag#v}" + + + # Get the current version directly from this file (assumed to be default.nix or zed-bin.nix) + # This assumes the script is run from the same directory as the Nix expression + current_version=$(nix-instantiate --eval -E "with import ./. {}; ${pname}.version" | tr -d '"') + + # Compare versions + if [[ "$latest_version" == "$current_version" ]]; then + echo "${pname} is already up-to-date at version $current_version" + exit 0 + fi + + echo "Updating ${pname} from $current_version to $latest_version..." + + # Use nix-update to automatically update the version and hash in the Nix expression + # Adjust the attribute path (-A) if this expression is part of a larger package set + # Assumes the attribute path is 'zed-bin' within the file being evaluated (e.g. '.') + nix-update --commit -A ${pname} --version "$latest_version" + + echo "Update complete. Remember to verify the changes." + ''; + + # Metadata about the package + meta = with lib; { + description = "A high-performance, multiplayer code editor (pre-built binary)"; + homepage = "https://zed.dev/"; + # Zed's source has multiple licenses (GPL3, Apache2, SSPL). + # The license for the pre-built binary distribution is less clear. + # Using 'unfree' is the safest approach for distributing binaries + # without a clear, permissive redistribution license. + license = licenses.gpl3; + # Replace 'yourGithubUsername' with your actual GitHub username if maintaining + maintainers = with maintainers; [ + # yourGithubUsername + ]; + # Specify the platform this binary is built for + platforms = [ "x86_64-linux" ]; + # Indicate that this package contains pre-compiled binary code + sourceProvenance = [ sourceTypes.binaryNativeCode ]; + # Set the main program + mainProgram = "zed"; + }; +}