From fb8bdfd7da7b23770ad18b0cf3de3d679c7506c7 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Wed, 26 Jun 2024 19:12:54 +0200 Subject: [PATCH] Adapt to https://github.com/Holo-Host/holo-nixpkgs/pull/2150 --- .github/workflows/build-hds.yaml | 25 +++++++++++++++++++++++++ flake.nix | 26 +++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-hds.yaml b/.github/workflows/build-hds.yaml index f505acc..4ef379a 100644 --- a/.github/workflows/build-hds.yaml +++ b/.github/workflows/build-hds.yaml @@ -13,6 +13,8 @@ jobs: runs-on: ${{ matrix.build-config.runner }} outputs: nixpkgs-revision: ${{ steps.nixpkgs-revision.outputs.nixpkgs-revision }} + rust-overlay-revision: ${{ steps.rust-overlay-revision.outputs.rust-overlay-revision }} + rust-version: ${{ steps.rust-version.outputs.rust-version }} build-deps: ${{ steps.build-deps.outputs.build-deps }} strategy: matrix: @@ -67,6 +69,16 @@ jobs: run: | echo "nixpkgs-revision=$(nix eval --raw '.#legacyPackages.${{ matrix.build-config.system }}.holo-dev-server-bin.nixpkgs-revision')" >> ${GITHUB_OUTPUT} + - name: get rust-overlay revision + id: rust-overlay-revision + run: | + echo "rust-overlay-revision=$(nix eval --raw '.#legacyPackages.${{ matrix.build-config.system }}.holo-dev-server-bin.rust-overlay-revision')" >> ${GITHUB_OUTPUT} + + - name: get rust version + id: rust-version + run: | + echo "rust-version=$(nix eval --raw '.#legacyPackages.${{ matrix.build-config.system }}.holo-dev-server-bin.rust-version')" >> ${GITHUB_OUTPUT} + - name: get build deps id: build-deps run: | @@ -160,6 +172,12 @@ jobs: tar -xzf <(curl --location https://github.com/nixos/nixpkgs/archive/${{ needs.build.outputs.nixpkgs-revision }}.tar.gz) echo "hash=$(nix hash path --base32 nixpkgs-${{ needs.build.outputs.nixpkgs-revision }}/)" >> ${GITHUB_OUTPUT} + - name: prefetch rust-overlay + id: prefetch-rust-overlay + run: | + tar -xzf <(curl --location https://github.com/oxalica/rust-overlay/archive/${{ needs.build.outputs.rust-overlay-revision }}.tar.gz) + echo "hash=$(nix hash path --base32 rust-overlay-${{ needs.build.outputs.rust-overlay-revision }}/)" >> ${GITHUB_OUTPUT} + - name: prefetch x86_64-linux binary id: prefetch-x86_64-linux run: | @@ -187,6 +205,13 @@ jobs: url = "https://github.com/nixos/nixpkgs/archive/${{ needs.build.outputs.nixpkgs-revision }}.tar.gz"; sha256 = "${{ steps.prefetch-nixpkgs.outputs.hash }}"; }; + + rust-overlay = builtins.fetchTarball { + url = "https://github.com/oxalica/rust-overlay/archive/${{ needs.build.outputs.rust-overlay-revision }}.tar.gz"; + sha256 = "${{ steps.prefetch-rust-overlay.outputs.hash }}"; + }; + rust-version = "${{ needs.build.outputs.rust-version }}"; + x86_64-linux.holo-dev-server-bin = builtins.fetchTarball { url = "https://github.com/${{ github.repository }}/releases/download/${{ needs.upload-binary.outputs.release_name }}/holo-dev-server-x86_64-linux.tar.gz"; sha256 = "${{ steps.prefetch-x86_64-linux.outputs.hash }}"; diff --git a/flake.nix b/flake.nix index 94ff00d..e898cde 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,31 @@ { packages = forEachSystem (system: let - pkgs = import srcs.nixpkgs { inherit system; }; + pkgs = import srcs.nixpkgs { + inherit system; + overlays = [ + (import srcs.rust-overlay) + (final: prev: { + rust = + let + rustStable = final.rust-bin.stable.${srcs.rust-version}.default; + in + prev.rust // { + packages = prev.rust.packages // { + stable = { + rustPlatform = final.makeRustPlatform { + inherit (final.rust.packages.stable) rustc cargo; + }; + + inherit (final.rust.packages.stable.rustPlatform) rust; + rustc = rustStable; + cargo = rustStable; + }; + }; + }; + }) + ]; + }; inherit (pkgs) lib; in {