Skip to content

Commit

Permalink
Merge pull request #207 from holochain/0.3-add-trycp-build
Browse files Browse the repository at this point in the history
0.3 add trycp build
  • Loading branch information
ThetaSinner authored May 30, 2024
2 parents 2fe3d4b + 61aa71f commit 8df9846
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
- name: Run tests
run: nix develop -c $SHELL -c "npm t"

- name: Build trycp-server package
run: nix build .#trycp-server

- name: Setup tmate session if build or test run failed
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
Expand Down
78 changes: 77 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 43 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,63 @@
versions.url = "github:holochain/holochain?dir=versions/0_3_rc";
holonix.url = "github:holochain/holochain";
holonix.inputs.versions.follows = "versions";

# lib to build a nix package from a rust crate
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};

# Rust toolchain
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs@{ holonix, ... }:
outputs = inputs@{ nixpkgs, holonix, crane, rust-overlay, ... }:
holonix.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
# provide a dev shell for all systems that the holonix flake supports
systems = builtins.attrNames holonix.devShells;

perSystem = { config, system, pkgs, ... }:
perSystem = { config, system, pkgs, lib, ... }:
{
formatter = pkgs.nixpkgs-fmt;

devShells.default = pkgs.mkShell {
inputsFrom = [ holonix.devShells.${system}.holochainBinaries ];
packages = with pkgs; [
# add further packages from nixpkgs
nodejs
];
};

packages.trycp-server =
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};

rustToolchain = pkgs.rust-bin.stable."1.78.0".minimal;

craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;

crateInfo = craneLib.crateNameFromCargoToml { cargoToml = ./crates/trycp_server/Cargo.toml; };
in
craneLib.buildPackage {
pname = "trycp-server";
version = crateInfo.version;
src = craneLib.cleanCargoSource (craneLib.path ./.);
doCheck = false;

buildInputs = [ ]
++ (lib.optionals pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk_11_0.frameworks; [
CoreFoundation
Security
]));
};
};
};
}

0 comments on commit 8df9846

Please sign in to comment.