From d8f4cb3559c5cebf7d779eb63a90d37ecd6376a8 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Thu, 2 Jan 2025 18:29:44 +0000 Subject: [PATCH] nix/flake.lock: Update; nix/flake.nix: backport patches from NixOS/nixpkgs (#6540) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nix/flake.nix: harfbuzz: 8.4.0 -> 9.0.0 * nix/flake.lock: Update Flake lock file updates: • Updated input 'flake-utils': 'github:numtide/flake-utils/c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a?narHash=sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ%3D' (2024-09-17) → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13) • Updated input 'harfbuzz': 'github:harfbuzz/harfbuzz/63973005bc07aba599b47fdd4cf788647b601ccd?narHash=sha256-GdxcAPx5QyniSHPAN1ih28AD9JLUPR0ItqW9JEsl3pU%3D' (2024-03-29) → 'github:harfbuzz/harfbuzz/9c03576c49db6e7207d9bcdfe3abd170a809157f?narHash=sha256-2ieCf3ftNk851FZBDPVl%2B7QHWBqD729KiUxUyxi26Yg%3D' (2024-06-27) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/ccc0c2126893dd20963580b6478d1a10a4512185?narHash=sha256-4HQI%2B6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo%3D' (2024-10-18) → 'github:NixOS/nixpkgs/69b9a8c860bdbb977adfa9c5e817ccb717884182?narHash=sha256-5zJyv66q68QZJZsXtmjDBazGnF0id593VSy%2B8eSckoo%3D' (2024-12-31) • Updated input 'rust-overlay': 'github:oxalica/rust-overlay/ada8266712449c4c0e6ee6fcbc442b3c217c79e1?narHash=sha256-r0VyeJxy4O4CgTB/PNtfQft9fPfN1VuGvnZiCxDArvg%3D' (2024-10-21) → 'github:oxalica/rust-overlay/04d5f1836721461b256ec452883362c5edc5288e?narHash=sha256-tIl5p3ueaPw7T5T1UXkLc8ISMk6Y8CI/D/rd0msf73I%3D' (2025-01-02) * nix/flake.nix: backport patches from NixOS/nixpkgs * nix/flake.nix: add formatter * nix/flake.nix: zlib: 1.2.11 -> 1.3.1 * nix/flake.lock: Update Flake lock file updates: • Updated input 'zlib': 'github:madler/zlib/cacf7f1d4e3d44d871b605da3b647f07d718623f?narHash=sha256-j5b6aki1ztrzfCqu8y729sPar8GpyQWIrajdzpJC%2Bww%3D' (2017-01-15) → 'github:madler/zlib/51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf?narHash=sha256-TkPLWSN5QcPlL9D0kc/yhH0/puE9bFND24aj5NVDKYs%3D' (2024-01-22) * nix/flake.nix: libpng: 8439534daa1d3a5705ba92e653eda9251246dd61 -> 1.6.44 * nix/flake.lock: Update Flake lock file updates: • Updated input 'libpng': 'github:glennrp/libpng/8439534daa1d3a5705ba92e653eda9251246dd61?narHash=sha256-1%2BcRp0Ungme/OGfc9kGJbklYIWAFxk8Il1M%2BNV4KSgw%3D' (2019-02-04) → 'github:pnggroup/libpng/f5e92d76973a7a53f517579bc95d61483bf108c0?narHash=sha256-gBfHgGaqVYdmhWXoNKZzPyGzyw2rr3zp%2BDjWmfC41jk%3D' (2024-09-12) --- nix/flake.lock | 46 +++---- nix/flake.nix | 364 ++++++++++++++++++++++++++----------------------- 2 files changed, 215 insertions(+), 195 deletions(-) diff --git a/nix/flake.lock b/nix/flake.lock index c166132ed1c..28c5b5b37b6 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -38,16 +38,16 @@ "harfbuzz": { "flake": false, "locked": { - "lastModified": 1711722720, - "narHash": "sha256-GdxcAPx5QyniSHPAN1ih28AD9JLUPR0ItqW9JEsl3pU=", + "lastModified": 1719502711, + "narHash": "sha256-2ieCf3ftNk851FZBDPVl+7QHWBqD729KiUxUyxi26Yg=", "owner": "harfbuzz", "repo": "harfbuzz", - "rev": "63973005bc07aba599b47fdd4cf788647b601ccd", + "rev": "9c03576c49db6e7207d9bcdfe3abd170a809157f", "type": "github" }, "original": { "owner": "harfbuzz", - "ref": "8.4.0", + "ref": "9.0.0", "repo": "harfbuzz", "type": "github" } @@ -55,27 +55,27 @@ "libpng": { "flake": false, "locked": { - "lastModified": 1549245649, - "narHash": "sha256-1+cRp0Ungme/OGfc9kGJbklYIWAFxk8Il1M+NV4KSgw=", - "owner": "glennrp", + "lastModified": 1726173884, + "narHash": "sha256-gBfHgGaqVYdmhWXoNKZzPyGzyw2rr3zp+DjWmfC41jk=", + "owner": "pnggroup", "repo": "libpng", - "rev": "8439534daa1d3a5705ba92e653eda9251246dd61", + "rev": "f5e92d76973a7a53f517579bc95d61483bf108c0", "type": "github" }, "original": { - "owner": "glennrp", + "owner": "pnggroup", + "ref": "v1.6.44", "repo": "libpng", - "rev": "8439534daa1d3a5705ba92e653eda9251246dd61", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1729265718, - "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=", + "lastModified": 1735617354, + "narHash": "sha256-5zJyv66q68QZJZsXtmjDBazGnF0id593VSy+8eSckoo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ccc0c2126893dd20963580b6478d1a10a4512185", + "rev": "69b9a8c860bdbb977adfa9c5e817ccb717884182", "type": "github" }, "original": { @@ -103,11 +103,11 @@ ] }, "locked": { - "lastModified": 1729477859, - "narHash": "sha256-r0VyeJxy4O4CgTB/PNtfQft9fPfN1VuGvnZiCxDArvg=", + "lastModified": 1735784864, + "narHash": "sha256-tIl5p3ueaPw7T5T1UXkLc8ISMk6Y8CI/D/rd0msf73I=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ada8266712449c4c0e6ee6fcbc442b3c217c79e1", + "rev": "04d5f1836721461b256ec452883362c5edc5288e", "type": "github" }, "original": { @@ -134,16 +134,16 @@ "zlib": { "flake": false, "locked": { - "lastModified": 1484501380, - "narHash": "sha256-j5b6aki1ztrzfCqu8y729sPar8GpyQWIrajdzpJC+ww=", + "lastModified": 1705948357, + "narHash": "sha256-TkPLWSN5QcPlL9D0kc/yhH0/puE9bFND24aj5NVDKYs=", "owner": "madler", "repo": "zlib", - "rev": "cacf7f1d4e3d44d871b605da3b647f07d718623f", + "rev": "51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf", "type": "github" }, "original": { "owner": "madler", - "ref": "v1.2.11", + "ref": "v1.3.1", "repo": "zlib", "type": "github" } diff --git a/nix/flake.nix b/nix/flake.nix index 5e925cad854..2ffe4bacad6 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -25,197 +25,217 @@ flake = false; }; harfbuzz = { - url = "github:harfbuzz/harfbuzz/8.4.0"; + url = "github:harfbuzz/harfbuzz/9.0.0"; flake = false; }; libpng = { - url = "github:glennrp/libpng/8439534daa1d3a5705ba92e653eda9251246dd61"; + url = "github:pnggroup/libpng/v1.6.44"; flake = false; }; zlib = { - url = "github:madler/zlib/v1.2.11"; + url = "github:madler/zlib/v1.3.1"; flake = false; }; }; - outputs = inputs @ {self, ...}: - inputs.flake-utils.lib.eachDefaultSystem (system: let - overlays = [(import inputs.rust-overlay)]; - pkgs = import (inputs.nixpkgs) {inherit system overlays;}; - - inherit (inputs.nixpkgs) lib; - inherit (pkgs) stdenv; - - nativeBuildInputs = with pkgs; - [ - installShellFiles - ncurses # tic for terminfo - pkg-config - python3 - ] - ++ lib.optional stdenv.isDarwin perl; - - buildInputs = with pkgs; - [ - fontconfig - pkgs.zlib - ] - ++ lib.optionals stdenv.isLinux [ - libxkbcommon - openssl - wayland - - xorg.libX11 - xorg.libxcb - xorg.xcbutil - xorg.xcbutilimage - xorg.xcbutilkeysyms - xorg.xcbutilwm # contains xcb-ewmh among others - ] - ++ lib.optionals stdenv.isDarwin ( - (with pkgs.darwin.apple_sdk_12_3.frameworks; [ - Cocoa - CoreGraphics - Foundation - UserNotifications - ]) - ++ [pkgs.libiconv] + outputs = + inputs@{ self, ... }: + inputs.flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ (import inputs.rust-overlay) ]; + pkgs = import (inputs.nixpkgs) { inherit system overlays; }; + + inherit (inputs.nixpkgs) lib; + inherit (pkgs) stdenv; + + nativeBuildInputs = + with pkgs; + [ + installShellFiles + ncurses # tic for terminfo + pkg-config + python3 + ] + ++ lib.optional stdenv.isDarwin perl; + + buildInputs = + with pkgs; + [ + fontconfig + zlib + ] + ++ lib.optionals stdenv.isLinux [ + libxkbcommon + openssl + wayland + + xorg.libX11 + xorg.libxcb + xorg.xcbutil + xorg.xcbutilimage + xorg.xcbutilkeysyms + xorg.xcbutilwm # contains xcb-ewmh among others + ] + ++ lib.optionals stdenv.isDarwin ([ + libiconv + ]); + + libPath = lib.makeLibraryPath ( + with pkgs; + [ + xorg.xcbutilimage + libGL + vulkan-loader + ] ); - libPath = lib.makeLibraryPath (with pkgs; [ - xorg.xcbutilimage - libGL - vulkan-loader - ]); - - rustPlatform = pkgs.makeRustPlatform { - cargo = pkgs.rust-bin.stable.latest.minimal; - rustc = pkgs.rust-bin.stable.latest.minimal; - }; - in { - packages.default = rustPlatform.buildRustPackage rec { - inherit buildInputs nativeBuildInputs; - - name = "wezterm"; - src = ./..; - version = self.shortRev or "dev"; - - cargoLock = { - lockFile = ../Cargo.lock; - allowBuiltinFetchGit = true; + rustPlatform = pkgs.makeRustPlatform { + cargo = pkgs.rust-bin.stable.latest.minimal; + rustc = pkgs.rust-bin.stable.latest.minimal; }; - - preConfigure = '' - rm -rf deps/freetype/freetype2 deps/freetype/libpng \ - deps/freetype/zlib deps/harfbuzz/harfbuzz - - ln -s ${inputs.freetype2} deps/freetype/freetype2 - ln -s ${inputs.libpng} deps/freetype/libpng - ln -s ${inputs.zlib} deps/freetype/zlib - ln -s ${inputs.harfbuzz} deps/harfbuzz/harfbuzz - ''; - - postPatch = '' - echo ${version} > .tag - - # tests are failing with: Unable to exchange encryption keys - rm -r wezterm-ssh/tests - - # hash does not work well with NixOS - substituteInPlace assets/shell-integration/wezterm.sh \ - --replace-fail 'hash wezterm 2>/dev/null' 'command type -P wezterm &>/dev/null' \ - --replace-fail 'hash base64 2>/dev/null' 'command type -P base64 &>/dev/null' \ - --replace-fail 'hash hostname 2>/dev/null' 'command type -P hostname &>/dev/null' \ - --replace-fail 'hash hostnamectl 2>/dev/null' 'command type -P hostnamectl &>/dev/null' - ''; - - preFixup = lib.optionalString stdenv.isLinux '' - patchelf \ - --add-needed "${pkgs.libGL}/lib/libEGL.so.1" \ - --add-needed "${pkgs.vulkan-loader}/lib/libvulkan.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" - ''; - - postInstall = '' - mkdir -p $out/nix-support - echo "${passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages - - 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 - - install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d - installShellCompletion --cmd wezterm \ - --bash assets/shell-completion/bash \ - --fish assets/shell-completion/fish \ - --zsh assets/shell-completion/zsh - - install -Dm644 assets/wezterm-nautilus.py -t $out/share/nautilus-python/extensions - ''; - - passthru = { - # the headless variant is useful when deploying wezterm's mux server on remote severs - headless = rustPlatform.buildRustPackage { - pname = "wezterm-headless"; - inherit version src postPatch cargoLock meta; - - nativeBuildInputs = [ pkgs.pkg-config ]; - - buildInputs = [ pkgs.openssl ]; - - cargoBuildFlags = [ - "--package" "wezterm" - "--package" "wezterm-mux-server" - ]; - - doCheck = false; - - postInstall = '' - install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d - install -Dm644 ${passthru.terminfo}/share/terminfo/w/wezterm -t $out/share/terminfo/w - ''; + in + { + packages.default = rustPlatform.buildRustPackage rec { + inherit buildInputs nativeBuildInputs; + + name = "wezterm"; + src = ./..; + version = self.shortRev or "dev"; + + cargoLock = { + lockFile = ../Cargo.lock; + allowBuiltinFetchGit = true; }; - terminfo = - pkgs.runCommand "wezterm-terminfo" - { - nativeBuildInputs = [pkgs.ncurses]; - } '' - mkdir -p $out/share/terminfo $out/nix-support - tic -x -o $out/share/terminfo ${src}/termwiz/data/wezterm.terminfo + env.NIX_CFLAGS_COMPILE = toString [ "-Wno-macro-redefined" ]; + + prePatch = '' + rm -rf deps/freetype/{freetype2,libpng,zlib} deps/harfbuzz/harfbuzz + + mkdir -p deps/freetype/{freetype2,libpng,zlib} deps/harfbuzz/harfbuzz + + cp -r ${inputs.freetype2}/* deps/freetype/freetype2 + cp -r ${inputs.libpng}/* deps/freetype/libpng + cp -r ${inputs.zlib}/* deps/freetype/zlib + cp -r ${inputs.harfbuzz}/* deps/harfbuzz/harfbuzz + ''; + + postPatch = '' + echo ${version} > .tag + + # tests are failing with: Unable to exchange encryption keys + rm -r wezterm-ssh/tests + + # hash does not work well with NixOS + substituteInPlace assets/shell-integration/wezterm.sh \ + --replace-fail 'hash wezterm 2>/dev/null' 'command type -P wezterm &>/dev/null' \ + --replace-fail 'hash base64 2>/dev/null' 'command type -P base64 &>/dev/null' \ + --replace-fail 'hash hostname 2>/dev/null' 'command type -P hostname &>/dev/null' \ + --replace-fail 'hash hostnamectl 2>/dev/null' 'command type -P hostnamectl &>/dev/null' + ''; + + preFixup = + lib.optionalString stdenv.isLinux '' + patchelf \ + --add-needed "${pkgs.libGL}/lib/libEGL.so.1" \ + --add-needed "${pkgs.vulkan-loader}/lib/libvulkan.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" ''; - }; - meta.mainProgram = "wezterm"; - }; + postInstall = '' + mkdir -p $out/nix-support + echo "${passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages + + 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 + + install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d + installShellCompletion --cmd wezterm \ + --bash assets/shell-completion/bash \ + --fish assets/shell-completion/fish \ + --zsh assets/shell-completion/zsh + + install -Dm644 assets/wezterm-nautilus.py -t $out/share/nautilus-python/extensions + ''; + + passthru = { + # the headless variant is useful when deploying wezterm's mux server on remote severs + headless = rustPlatform.buildRustPackage { + pname = "wezterm-headless"; + inherit + version + src + postPatch + cargoLock + meta + ; + + nativeBuildInputs = [ pkgs.pkg-config ]; + + buildInputs = [ pkgs.openssl ]; + + cargoBuildFlags = [ + "--package" + "wezterm" + "--package" + "wezterm-mux-server" + ]; - devShell = pkgs.mkShell { - name = "wezterm-shell"; - inherit nativeBuildInputs; + doCheck = false; + + postInstall = '' + install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d + install -Dm644 ${passthru.terminfo}/share/terminfo/w/wezterm -t $out/share/terminfo/w + ''; + }; + + terminfo = + pkgs.runCommand "wezterm-terminfo" + { + nativeBuildInputs = [ pkgs.ncurses ]; + } + '' + mkdir -p $out/share/terminfo $out/nix-support + tic -x -o $out/share/terminfo ${src}/termwiz/data/wezterm.terminfo + ''; + }; - buildInputs = - buildInputs - ++ (with pkgs.rust-bin; [ - (stable.latest.minimal.override { - extensions = [ - "clippy" - "rust-src" - ]; - }) + meta.mainProgram = "wezterm"; + }; - nightly.latest.rustfmt - nightly.latest.rust-analyzer - ]); + devShell = pkgs.mkShell { + name = "wezterm-shell"; + inherit nativeBuildInputs; + + buildInputs = + buildInputs + ++ (with pkgs.rust-bin; [ + (stable.latest.minimal.override { + extensions = [ + "clippy" + "rust-src" + ]; + }) + + nightly.latest.rustfmt + nightly.latest.rust-analyzer + ]); + + LD_LIBRARY_PATH = libPath; + RUST_BACKTRACE = 1; + }; - LD_LIBRARY_PATH = libPath; - RUST_BACKTRACE = 1; - }; - }); + formatter = pkgs.nixfmt-rfc-style; + } + ); }