Skip to content

Commit

Permalink
Merge pull request #3 from Holo-Host/include-rust-overlay
Browse files Browse the repository at this point in the history
Include rust overlay
  • Loading branch information
r-vdp authored Jul 8, 2024
2 parents d6ec14d + fb8bdfd commit 7f8741f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/build-hds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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 }}";
Expand Down
26 changes: 25 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 7f8741f

Please sign in to comment.