From 41b11df1406c83a3687f729438b065890ca7a6a9 Mon Sep 17 00:00:00 2001 From: James Walker Date: Fri, 20 Oct 2023 15:53:34 -0400 Subject: [PATCH] chore: add a nix package (#392) # Description Adding a default package definition to the flake (and also tests the build in CI) ## Link to issue Related to https://github.com/ipvm-wg/homestar/issues/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 --- .github/workflows/nix.yml | 5 +++-- .gitignore | 3 +++ examples/websocket-relay/README.md | 2 +- flake.nix | 22 ++++++++++++++++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 8f64bbc8..2095b3ef 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -2,10 +2,10 @@ name: 📦 Nix Build on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ '**' ] + branches: ["**"] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -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 diff --git a/.gitignore b/.gitignore index 3972eb8f..0b74cf8d 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ examples/**/tmp/* !examples/**/**/.env.example !examples/**/tmp/.gitkeep + +# nix build results +/result diff --git a/examples/websocket-relay/README.md b/examples/websocket-relay/README.md index bc5c4597..a89cafaa 100644 --- a/examples/websocket-relay/README.md +++ b/examples/websocket-relay/README.md @@ -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 diff --git a/flake.nix b/flake.nix index 1b4fe582..bbd189f4 100644 --- a/flake.nix +++ b/flake.nix @@ -234,8 +234,7 @@ wasmTest wasmAdd ]; - in rec - { + in { devShells.default = pkgs.mkShell { name = "homestar"; nativeBuildInputs = with pkgs; @@ -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; } );