diff --git a/overlays/halloy-overlay.nix b/overlays/halloy-overlay.nix index c8f0491..87b2548 100644 --- a/overlays/halloy-overlay.nix +++ b/overlays/halloy-overlay.nix @@ -1,26 +1,10 @@ -self: super: { - # First create a patched version of cryoglyph - cryoglyph = super.rustPlatform.buildRustPackage rec { - pname = "cryoglyph"; - version = "0.1.0"; - - src = super.fetchFromGitHub { - owner = "iced-rs"; - repo = "cryoglyph"; - rev = "a456d1c17bbcf33afcca41d9e5e299f9f1193819"; # Get this from Halloy's Cargo.lock - sha256 = "sha256-X7S9jq8wU6g1DDNEzOtP3lKWugDnpopPDBK49iWvD4o="; - }; - - RUSTC_BOOTSTRAP = 1; - - postPatch = '' - sed -i '1i cargo-features = ["edition2024"]' Cargo.toml - ''; - - cargoHash = "sha256-0000000000000000000000000000000000000000000000000000"; # Let Nix fill this +self: super: +let + # Pin to a specific nightly that supports edition2024 + rustNightly = super.rust-bin.nightly."2025-05-14".default.override { + extensions = [ "rust-src" ]; }; - - # Now build Halloy with the patched cryoglyph +in { halloy = super.rustPlatform.buildRustPackage rec { pname = "halloy"; version = "2025.5"; @@ -32,33 +16,30 @@ self: super: { sha256 = "sha256-cG/B6oiRkyoC5fK7bLdCDQYZymfMZspWXvOkqpwHRPk="; }; - RUSTC_BOOTSTRAP = 1; + # Force use of pinned nightly toolchain + cargo = rustNightly; + rustc = rustNightly; - nativeBuildInputs = with super; [ - pkg-config - (rust-bin.nightly."2025-05-14".default.override { - extensions = [ "rust-src" ]; - }) - ]; + # Required for edition2024 features + RUSTC_BOOTSTRAP = 1; + # Patch all Cargo.toml files recursively postPatch = '' - sed -i '1i cargo-features = ["edition2024"]' Cargo.toml - sed -i 's|^cryoglyph = .*|cryoglyph = { path = "${self.cryoglyph.src}" }|' Cargo.toml + find . -name Cargo.toml -exec sed -i '1i cargo-features = ["edition2024"]' {} \; ''; - cargoLock = { - lockFile = super.fetchurl { - url = "https://raw.githubusercontent.com/squidowl/halloy/${version}/Cargo.lock"; - sha256 = "sha256-s5e8T+ODhiK/fFH4lIs7SnIZX0unZPqsDIct5cntG8E="; - }; - + # Use crane's vendor approach for better dependency handling + cargoDeps = super.rustPlatform.importCargoLock { + lockFile = src + "/Cargo.lock"; outputHashes = { + "cryoglyph-0.1.0" = "sha256-X7S9jq8wU6g1DDNEzOtP3lKWugDnpopPDBK49iWvD4o="; "dark-light-2.0.0" = "sha256-e826vF7iSkGUqv65TXHBUX04Kz2aaJJEW9f7JsAMaXE="; "iced-0.14.0-dev" = "sha256-FEGk1zkXM9o+fGMoDtmi621G6pL+Yca9owJz4q2Lzks="; - "cryoglyph-0.1.0" = ""; - "dpi-0.1.1" = ""; + "dpi-0.1.1" = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }; }; + + nativeBuildInputs = with super; [ pkg-config ]; buildInputs = with super; [ libxkbcommon