From cbb594395a132c7057f171eea1ad7bb0caf482fc Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Thu, 26 Jun 2025 20:46:31 +0200 Subject: [PATCH] helix: build with lto and native cpu target --- packages/default.nix | 15 +++++++++++++-- packages/helix/default.nix | 34 +++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/packages/default.nix b/packages/default.nix index 6b50927..8fb4dfb 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,6 +1,17 @@ -{pkgs}: let +{ + inputs, + pkgs, +}: let inherit (pkgs) lib; - helix = pkgs.callPackage ./helix {}; + helix = let + latestNightly = (inputs.rust-overlay.lib.mkRustBin {} pkgs).nightly.latest.default; + rustPlatform = pkgs.makeRustPlatform { + rustc = latestNightly; + cargo = latestNightly; + stdenv = pkgs.clangStdenv; + }; + in + pkgs.callPackage ./helix {inherit rustPlatform;}; kakoune = pkgs.callPackage ./kakoune.nix {}; fish = pkgs.callPackage ./fish {inherit lib;}; in { diff --git a/packages/helix/default.nix b/packages/helix/default.nix index e93d18d..730cee9 100644 --- a/packages/helix/default.nix +++ b/packages/helix/default.nix @@ -41,20 +41,28 @@ }: let inherit (lib.meta) getExe; - custom-helix = helix.overrideAttrs (_: rec { - version = "25.06.1"; - src = fetchzip { - url = "https://github.com/bloxx12/helix/releases/download/${version}/helix-${version}-source.tar.xz"; - hash = "sha256-941moaBUF+aGsbFapK1cp5+NFdecSfRCTdnVUtkDQps="; - stripRoot = false; - }; + custom-helix = + (helix.override {inherit rustPlatform;}).overrideAttrs + (_: let + inherit (custom-helix) version; + in { + version = "25.06.1"; + src = fetchzip { + url = "https://github.com/bloxx12/helix/releases/download/${version}/helix-${version}-source.tar.xz"; + hash = "sha256-941moaBUF+aGsbFapK1cp5+NFdecSfRCTdnVUtkDQps="; + stripRoot = false; + }; - doInstallCheck = false; - cargoDeps = rustPlatform.fetchCargoVendor { - inherit (custom-helix) src; - hash = "sha256-w07ZV1tR3lzYz4N+hI9alvFp0AHCcsItPRhVt9Sluo8="; - }; - }); + cargoBuildFeatures = ["unicode-lines"]; + RUSTFLAGS = "-Ctarget-cpu=native -Clto=fat"; + + doInstallCheck = false; + + cargoDeps = rustPlatform.fetchCargoVendor { + inherit (custom-helix) src; + hash = "sha256-w07ZV1tR3lzYz4N+hI9alvFp0AHCcsItPRhVt9Sluo8="; + }; + }); toml = formats.toml {};