From 81022275d90bd6507b476c9b525960676d81d6dc Mon Sep 17 00:00:00 2001 From: fortuneteller2k Date: Tue, 22 Aug 2023 19:36:54 +0800 Subject: [PATCH] wezterm-git without crane --- .github/workflows/build-darwin.yml | 2 +- flake.nix | 2 - overlays/terminal-emulators.nix | 24 ++++-- pkgs/wezterm/default.nix | 119 ----------------------------- 4 files changed, 17 insertions(+), 130 deletions(-) delete mode 100644 pkgs/wezterm/default.nix diff --git a/.github/workflows/build-darwin.yml b/.github/workflows/build-darwin.yml index 8056c97..b4b7263 100644 --- a/.github/workflows/build-darwin.yml +++ b/.github/workflows/build-darwin.yml @@ -29,4 +29,4 @@ jobs: with: name: fortuneteller2k authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix build -L .#emacs-plus-git + - run: nix build -L .#emacs-plus-git .#wezterm-git diff --git a/flake.nix b/flake.nix index 8c29e0c..eb0511b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,6 @@ description = "fortuneteller2k's stash of fresh packages"; inputs = { - crane.url = "github:ipetkov/crane"; - rust.url = "github:oxalica/rust-overlay"; nixpkgs.url = "github:NixOS/nixpkgs/master"; nixpkgs-fmt.url = "github:nix-community/nixpkgs-fmt"; parts.url = "github:hercules-ci/flake-parts"; diff --git a/overlays/terminal-emulators.nix b/overlays/terminal-emulators.nix index e84526d..f00a049 100644 --- a/overlays/terminal-emulators.nix +++ b/overlays/terminal-emulators.nix @@ -2,14 +2,22 @@ { flake.overlays.terminal-emulators = _: prev: { - wezterm-git = - let - package = getPackage "wezterm" prev; - in - prev.darwin.apple_sdk_11_0.callPackage ../pkgs/wezterm { - inherit (prev.darwin.apple_sdk_11_0.frameworks) Cocoa CoreGraphics Foundation UserNotifications; - inherit (package) src version; - crane-lib = inputs.crane.lib.${prev.system}.overrideToolchain inputs.rust.packages.${prev.system}.rust_1_71_0; + wezterm-git = prev.darwin.apple_sdk_11_0.callPackage "${inputs.nixpkgs}/pkgs/applications/terminal-emulators/wezterm" { + inherit (prev.darwin.apple_sdk_11_0.frameworks) Cocoa CoreGraphics Foundation UserNotifications System; + + rustPlatform = prev.rustPlatform // { + buildRustPackage = args: prev.rustPlatform.buildRustPackage (args // rec { + inherit (getPackage "wezterm" prev) src version; + cargoLock = { + lockFile = "${src}/Cargo.lock"; + + outputHashes = { + "xcb-1.2.1" = "sha256-zkuW5ATix3WXBAj2hzum1MJ5JTX3+uVQ01R1vL6F1rY="; + "xcb-imdkit-0.2.0" = "sha256-L+NKD0rsCk9bFABQF4FZi9YoqBHr4VAZeKAWgsaAegw="; + }; + }; + }); }; + }; }; } diff --git a/pkgs/wezterm/default.nix b/pkgs/wezterm/default.nix deleted file mode 100644 index 2a42622..0000000 --- a/pkgs/wezterm/default.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ lib -, stdenv -, crane-lib -, runCommand -, src -, version -, dbus -, egl-wayland -, fontconfig -, freetype -, libGL -, libGLU -, libglvnd -, libX11 -, libxcb -, libxkbcommon -, ncurses -, openssl -, perl -, pkg-config -, python3 -, wayland -, xcbutil -, xcbutilimage -, xcbutilkeysyms -, xcbutilwm -, zlib -, CoreGraphics -, Cocoa -, Foundation -, libiconv -, UserNotifications -}: - -let - pname = "wezterm-git"; - - nativeBuildInputs = [ - pkg-config - python3 - ncurses - ] ++ lib.optional stdenv.isDarwin perl; - - buildInputs = [ - fontconfig - zlib - ] ++ lib.optionals stdenv.isLinux [ - dbus - egl-wayland - freetype - libGL - libGLU - libglvnd - libX11 - libxcb - libxkbcommon - openssl - wayland - xcbutil - xcbutilimage - xcbutilkeysyms - xcbutilwm - ] ++ lib.optionals stdenv.isDarwin [ - Cocoa - CoreGraphics - Foundation - libiconv - UserNotifications - ]; - - cargoArtifacts = crane-lib.buildDepsOnly { - inherit src pname version nativeBuildInputs buildInputs; - }; -in -crane-lib.buildPackage rec { - inherit src pname version cargoArtifacts nativeBuildInputs buildInputs; - - postInstall = '' - mkdir -p $out/nix-support - echo "${passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages - # desktop icon - install -Dm644 assets/icon/terminal.png $out/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png - install -Dm644 assets/wezterm.desktop $out/share/applications/org.wezfurlong.wezterm.desktop - install -Dm644 assets/wezterm.appdata.xml $out/share/metainfo/org.wezfurlong.wezterm.appdata.xml - # helper scripts - install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d - ''; - - preFixup = lib.optionalString stdenv.isLinux '' - patchelf --add-needed "${libGL}/lib/libEGL.so.1" $out/bin/wezterm-gui - '' + lib.optionalString stdenv.isDarwin '' - mkdir -p "$out/Applications" - OUT_APP="$out/Applications/WezTerm.app" - cp -r assets/macos/WezTerm.app "$OUT_APP" - rm $OUT_APP/*.dylib - cp -r assets/shell-integration/* "$OUT_APP" - ln -s $out/bin/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$OUT_APP" - ''; - - passthru.terminfo = runCommand "wezterm-terminfo" - { - nativeBuildInputs = [ - ncurses - ]; - } '' - mkdir -p $out/share/terminfo $out/nix-support - tic -x -o $out/share/terminfo ${src}/termwiz/data/wezterm.terminfo - ''; - - doCheck = false; - - meta = with lib; { - description = "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust"; - homepage = "https://wezfurlong.org/wezterm"; - license = licenses.mit; - platforms = platforms.unix; - maintainers = with maintainers; [ javacafe01 ]; - }; -}