Skip to content

Commit 8d73d99

Browse files
committed
Added a nix flake for cddl-codegen
1 parent 228fd49 commit 8d73d99

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

flake.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
description = "cddl-codegen: Generate Rust, WASM and JSON code from CDDL specifications";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
rust-overlay = {
8+
url = "github:oxalica/rust-overlay";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
};
12+
13+
outputs = {
14+
nixpkgs,
15+
flake-utils,
16+
rust-overlay,
17+
...
18+
}:
19+
flake-utils.lib.eachDefaultSystem (
20+
system: let
21+
pkgs = import nixpkgs {
22+
overlays = [(import rust-overlay)];
23+
inherit system;
24+
};
25+
26+
rustToolchain = pkgs.rust-bin.nightly.latest.default;
27+
28+
nativeBuildInputs = with pkgs; [
29+
rustToolchain
30+
pkg-config
31+
which
32+
];
33+
in {
34+
devShells.default = pkgs.mkShell {
35+
buildInputs = nativeBuildInputs;
36+
};
37+
38+
packages.default = pkgs.rustPlatform.buildRustPackage {
39+
pname = "cddl-codegen";
40+
version = "0.1.0";
41+
src = ./.;
42+
43+
cargoLock = {
44+
lockFile = ./Cargo.lock;
45+
allowBuiltinFetchGit = true;
46+
};
47+
48+
# the regular tests don't run yet
49+
checkPhase = ''
50+
cargo test comment_ast
51+
'';
52+
53+
inherit nativeBuildInputs;
54+
55+
meta = with pkgs.lib; {
56+
description = "Codegen serialization logic for CBOR automatically from a CDDL specification";
57+
homepage = "https://github.com/dcSpark/cddl-codegen";
58+
license = licenses.mit;
59+
maintainers = [];
60+
};
61+
};
62+
}
63+
);
64+
}

0 commit comments

Comments
 (0)