Skip to content

Commit

Permalink
chore: add a nix package (#392)
Browse files Browse the repository at this point in the history
# Description

Adding a default package definition to the flake (and also tests the
build in CI)

## Link to issue

Related to #362

## Type of change

- [x] New feature (non-breaking change that adds functionality)

Please delete options that are not relevant.

## Test plan (required)

The `nix` workflow will now build the default homestar package
  • Loading branch information
walkah committed Oct 20, 2023
1 parent fc542ef commit 41b11df
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: 📦 Nix Build

on:
push:
branches: [ main ]
branches: [main]

pull_request:
branches: [ '**' ]
branches: ["**"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -55,3 +55,4 @@ jobs:
run: |
nix develop --show-trace -c irust --version
nix develop --show-trace -c rustc --version
nix build . && ./result/bin/homestar --version
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ examples/**/tmp/*

!examples/**/**/.env.example
!examples/**/tmp/.gitkeep

# nix build results
/result
2 changes: 1 addition & 1 deletion examples/websocket-relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An example application that connects to a `homestar-runtime` node
over a websocket connection in order to run static Wasm-based, image
processing workflows that chain inputs and outputs using
[inlined promises][pipelines].

This application demonstrates:

* websocket notifications of [UCAN Invocation Receipts][spec-receipts] sent
Expand Down
22 changes: 20 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@
wasmTest
wasmAdd
];
in rec
{
in {
devShells.default = pkgs.mkShell {
name = "homestar";
nativeBuildInputs = with pkgs;
Expand Down Expand Up @@ -297,6 +296,25 @@
cargoSha256 = "sha256-FmsD3ajMqpPrTkXCX2anC+cmm0a2xuP+3FHqzj56Ma4=";
};

packages.default =
pkgs.rustPlatform.buildRustPackage
{
name = "homestar";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
buildInputs = with pkgs;
[rust-toolchain]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Foundation
];

doCheck = false;
};

formatter = pkgs.alejandra;
}
);
Expand Down

0 comments on commit 41b11df

Please sign in to comment.