Skip to content

Commit

Permalink
Merge pull request #189045 from leungbk/edea2
Browse files Browse the repository at this point in the history
ocamlPackages.plotkicadsch: init at 0.9
  • Loading branch information
superherointj committed Aug 31, 2022
2 parents 750bb80 + 9a64a6d commit 2c5484c
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkgs/development/ocaml-modules/git/unix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ buildDunePackage {
astring cohttp-lwt-unix decompress
domain-name ipaddr mtime mirage-flow
cstruct ptime mimic ca-certs-nss
tls tls-mirage
tls tls-mirage git
];
checkInputs = [
alcotest alcotest-lwt base64 ke
Expand Down
23 changes: 23 additions & 0 deletions pkgs/development/ocaml-modules/kicadsch/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ lib
, buildDunePackage
, fetchurl
}:

buildDunePackage rec {
pname = "kicadsch";
version = "0.9.0";

minimalOCamlVersion = "4.07";

src = fetchurl {
url = "https://github.com/jnavila/plotkicadsch/releases/download/v${version}/plotkicadsch-${version}.tbz";
sha256 = "sha256-B+vnEPyd3SUzviTdNoyvYk0p7Hrg/XTJm8KxsY8A4jQ=";
};

meta = with lib; {
description = "OCaml library for exporting Kicad Sch files to SVG pictures";
homepage = "https://github.com/jnavila/plotkicadsch";
license = licenses.isc;
maintainers = with maintainers; [ leungbk ];
};
}
50 changes: 50 additions & 0 deletions pkgs/development/ocaml-modules/plotkicadsch/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ lib
, buildDunePackage
, fetchFromGitHub
, substituteAll
, base64
, cmdliner
, digestif
, git-unix
, kicadsch
, lwt
, lwt_ppx
, sha
, tyxml
, coreutils
, imagemagick
}:

buildDunePackage rec {
pname = "plotkicadsch";

inherit (kicadsch) src version;

minimalOCamlVersion = "4.09";

patches = [
(substituteAll {
src = ./fix-paths.patch;
inherit coreutils imagemagick;
})
];

buildInputs = [
base64
cmdliner
digestif
git-unix
kicadsch
lwt
lwt_ppx
sha
tyxml
];

meta = with lib; {
description = "A tool to export Kicad Sch files to SVG pictures";
homepage = "https://github.com/jnavila/plotkicadsch";
license = licenses.isc;
maintainers = with maintainers; [ leungbk ];
};
}
26 changes: 26 additions & 0 deletions pkgs/development/ocaml-modules/plotkicadsch/fix-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/plotkicadsch/src/git-imgdiff b/plotkicadsch/src/git-imgdiff
index cbddecb..8d21a8a 100755
--- a/plotkicadsch/src/git-imgdiff
+++ b/plotkicadsch/src/git-imgdiff
@@ -1,4 +1,4 @@
#!/bin/bash
PIPE=$(mktemp -u)
-(! compare -metric RMSE $2 $1 png:${PIPE} 2> /dev/null) && (montage -geometry +4+4 $2 $PIPE $1 png:- | display -title "$1" -)
+(! @imagemagick@/bin/compare -metric RMSE $2 $1 png:${PIPE} 2> /dev/null) && (@imagemagick@/bin/montage -geometry +4+4 $2 $PIPE $1 png:- | @imagemagick@/bin/display -title "$1" -)
rm $PIPE
diff --git a/plotkicadsch/src/sysAbst.ml b/plotkicadsch/src/sysAbst.ml
index c3c7b52..15db6d4 100644
--- a/plotkicadsch/src/sysAbst.ml
+++ b/plotkicadsch/src/sysAbst.ml
@@ -30,7 +30,7 @@ let detect_os () : os =
if Sys.win32 then Windows
else if Sys.cygwin then Cygwin
else
- let ((in_ch, _, _) as uname) = UnixLabels.open_process_full "uname" ~env:[| |] in
+ let ((in_ch, _, _) as uname) = UnixLabels.open_process_full "@coreutils@/bin/uname" ~env:[| |] in
let os = input_line in_ch in
ignore (UnixLabels.close_process_full uname) ;
match os with
--
2.37.1

6 changes: 6 additions & 0 deletions pkgs/top-level/ocaml-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ let

ke = callPackage ../development/ocaml-modules/ke { };

kicadsch = callPackage ../development/ocaml-modules/kicadsch { };

lablgl = callPackage ../development/ocaml-modules/lablgl { };

lablgtk3 = callPackage ../development/ocaml-modules/lablgtk3 { };
Expand Down Expand Up @@ -1145,6 +1147,10 @@ let

piqi-ocaml = callPackage ../development/ocaml-modules/piqi-ocaml { };

plotkicadsch = callPackage ../development/ocaml-modules/plotkicadsch {
inherit (pkgs) coreutils imagemagick;
};

posix-base = callPackage ../development/ocaml-modules/posix/base.nix { };

posix-socket = callPackage ../development/ocaml-modules/posix/socket.nix { };
Expand Down

0 comments on commit 2c5484c

Please sign in to comment.