Skip to content

Commit b93400c

Browse files
amesgengeo2a
authored andcommitted
Add cddlc to Nix
Co-authored-by: Georgy Lukyanov <[email protected]>
1 parent 7e607f1 commit b93400c

File tree

7 files changed

+102
-3
lines changed

7 files changed

+102
-3
lines changed

nix/cddlc/Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source 'https://rubygems.org'
2+
gem 'cddlc'

nix/cddlc/Gemfile.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
cddlc (0.4.2)
5+
neatjson (~> 0.10)
6+
treetop (~> 1)
7+
neatjson (0.10.5)
8+
polyglot (0.3.5)
9+
treetop (1.6.14)
10+
polyglot (~> 0.3)
11+
12+
PLATFORMS
13+
ruby
14+
15+
DEPENDENCIES
16+
cddlc
17+
18+
BUNDLED WITH
19+
2.6.2

nix/cddlc/gemset.nix

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
cddlc = {
3+
dependencies = [
4+
"neatjson"
5+
"treetop"
6+
];
7+
groups = [ "default" ];
8+
platforms = [ ];
9+
source = {
10+
remotes = [ "https://rubygems.org" ];
11+
sha256 = "1s3fbgd5yqgji162zsmlwnva1v1r3zc1qiyv6im7karv5f08r8m3";
12+
type = "gem";
13+
};
14+
version = "0.4.2";
15+
};
16+
neatjson = {
17+
groups = [ "default" ];
18+
platforms = [ ];
19+
source = {
20+
remotes = [ "https://rubygems.org" ];
21+
sha256 = "0wm1lq8yl6rzysh3wg6fa55w5534k6ppiz0qb7jyvdy582mk5i0s";
22+
type = "gem";
23+
};
24+
version = "0.10.5";
25+
};
26+
polyglot = {
27+
groups = [ "default" ];
28+
platforms = [ ];
29+
source = {
30+
remotes = [ "https://rubygems.org" ];
31+
sha256 = "1bqnxwyip623d8pr29rg6m8r0hdg08fpr2yb74f46rn1wgsnxmjr";
32+
type = "gem";
33+
};
34+
version = "0.3.5";
35+
};
36+
treetop = {
37+
dependencies = [ "polyglot" ];
38+
groups = [ "default" ];
39+
platforms = [ ];
40+
source = {
41+
remotes = [ "https://rubygems.org" ];
42+
sha256 = "1m5fqy7vq6y7bgxmw7jmk7y6pla83m16p7lb41lbqgg53j8x2cds";
43+
type = "gem";
44+
};
45+
version = "1.6.14";
46+
};
47+
}

nix/cddlc/package.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ lib
2+
, bundlerApp
3+
, bundlerUpdateScript
4+
}:
5+
6+
bundlerApp {
7+
pname = "cddlc";
8+
9+
gemdir = ./.;
10+
11+
exes = [ "cddlc" ];
12+
13+
passthru.updateScript = bundlerUpdateScript "cddlc";
14+
15+
meta = {
16+
description = "CDDL conversion utilities";
17+
homepage = "https://github.com/cabo/cddlc";
18+
license = lib.licenses.mit;
19+
maintainers = with lib.maintainers; [ amesgen ];
20+
platforms = lib.platforms.unix;
21+
mainProgram = "cddlc";
22+
};
23+
}

nix/haskell.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ let
3535
extraSrcFiles = [ "golden/${n}/**/*" ];
3636
}) [ "byron" "shelley" "cardano" ]);
3737
}
38-
({ pkgs, lib, ... }: lib.mkIf pkgs.stdenv.hostPlatform.isWindows {
39-
# https://github.com/input-output-hk/haskell.nix/issues/2332
40-
packages.basement.configureFlags = [ "--hsc2hs-option=--cflag=-Wno-int-conversion" ];
38+
({ pkgs, ... }: {
39+
# Tools for CBOR/CDDL tests:
40+
packages.ouroboros-consensus-cardano.components.tests.cardano-test = {
41+
build-tools =
42+
[ pkgs.cddlc pkgs.cuddle ];
43+
extraSrcFiles = [ "cddl/**/*" ];
44+
};
4145
})
4246
];
4347
flake.variants = {

nix/shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ hsPkgs.shellFor {
1717
pkgs.xrefcheck
1818
pkgs.fourmolu
1919
pkgs.cuddle
20+
pkgs.cddlc
2021

2122
# release management
2223
pkgs.scriv

nix/tools.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ in
4747
};
4848
};
4949

50+
# remove once our nixpkgs contains https://github.com/NixOS/nixpkgs/pull/394873
51+
cddlc = final.callPackage ./cddlc/package.nix { };
52+
5053
haskellBuildUtils = prev.haskellBuildUtils.override {
5154
inherit (final.hsPkgs.args) compiler-nix-name;
5255
index-state = tool-index-state;

0 commit comments

Comments
 (0)