-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0812902
Showing
18 changed files
with
2,634 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: check | ||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
checks: | ||
name: format & build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
- name: System Info | ||
run: | | ||
uname -a | ||
nix --version | ||
- name: check | ||
run: nix flake check -L --show-trace | ||
|
||
- name: kairos-node | ||
run: nix build -L --no-link --show-trace .#packages.x86_64-linux.kairos-node | ||
|
||
- name: kairos-prover | ||
run: nix build -L --no-link --show-trace .#packages.x86_64-linux.kairos-prover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
result | ||
.direnv | ||
.envrc | ||
target | ||
.tmp | ||
.nixos-test-history |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
description = "kairos"; | ||
|
||
nixConfig = { | ||
extra-substituters = [ | ||
"https://crane.cachix.org" | ||
"https://nix-community.cachix.org" | ||
]; | ||
extra-trusted-public-keys = [ | ||
"crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=" | ||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" | ||
]; | ||
}; | ||
|
||
inputs = { | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
treefmt-nix.url = "github:numtide/treefmt-nix"; | ||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; | ||
fenix.url = "github:nix-community/fenix"; | ||
fenix.inputs.nixpkgs.follows = "nixpkgs"; | ||
crane.url = "github:ipetkov/crane"; | ||
crane.inputs.nixpkgs.follows = "nixpkgs"; | ||
advisory-db.url = "github:rustsec/advisory-db"; | ||
advisory-db.flake = false; | ||
risc0pkgs.url = "github:cspr-rad/risc0pkgs"; | ||
risc0pkgs.inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
|
||
outputs = inputs@{ self, flake-parts, treefmt-nix, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = [ "x86_64-linux" ]; | ||
imports = [ | ||
treefmt-nix.flakeModule | ||
./kairos-prover | ||
]; | ||
perSystem = { config, self', inputs', system, pkgs, lib, ... }: | ||
let | ||
rustToolchain = inputs'.fenix.packages.complete.toolchain; | ||
craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain; | ||
|
||
kairosNodeAttrs = { | ||
src = lib.cleanSourceWith { | ||
src = craneLib.path ./kairos-node; | ||
filter = path: type: craneLib.filterCargoSources path type; | ||
}; | ||
nativeBuildInputs = with pkgs; [ pkg-config openssl.dev ]; | ||
}; | ||
in | ||
{ | ||
devShells.default = pkgs.mkShell { | ||
# Rust Analyzer needs to be able to find the path to default crate | ||
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; | ||
|
||
nativeBuildInputs = [ | ||
rustToolchain | ||
] ++ kairosNodeAttrs.nativeBuildInputs; | ||
}; | ||
|
||
packages = { | ||
kairos-node-deps = craneLib.buildDepsOnly (kairosNodeAttrs // { | ||
pname = "kairos-node"; | ||
}); | ||
|
||
kairos-node = craneLib.buildPackage (kairosNodeAttrs // { | ||
cargoArtifacts = self'.packages.kairos-node-deps; | ||
}); | ||
|
||
default = self'.packages.kairos-node; | ||
|
||
kairos-node-docs = craneLib.cargoDoc (kairosNodeAttrs // { | ||
cargoArtifacts = self'.packages.kairos-node-deps; | ||
}); | ||
}; | ||
|
||
checks = { | ||
lint = craneLib.cargoClippy (kairosNodeAttrs // { | ||
cargoArtifacts = self'.packages.kairos-node-deps; | ||
cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | ||
}); | ||
|
||
coverage-report = craneLib.cargoTarpaulin (kairosNodeAttrs // { | ||
cargoArtifacts = self'.packages.kairos-node-deps; | ||
}); | ||
|
||
audit = craneLib.cargoAudit { | ||
inherit (kairosNodeAttrs) src; | ||
advisory-db = inputs.advisory-db; | ||
}; | ||
}; | ||
|
||
treefmt = { | ||
projectRootFile = ".git/config"; | ||
programs.nixpkgs-fmt.enable = true; | ||
programs.rustfmt.enable = true; | ||
programs.rustfmt.package = craneLib.rustfmt; | ||
settings.formatter = { }; | ||
}; | ||
}; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "kairos-node" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
Oops, something went wrong.