ocamlPackages.plotkicadsch: init at 0.9

This commit is contained in:
Brian Leung 2022-08-28 22:48:44 -07:00
parent 2b2e5df478
commit 9a64a6d1ef
No known key found for this signature in database
GPG key ID: 2D86D6A94C8BB3B1
3 changed files with 80 additions and 0 deletions

View file

@ -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 ];
};
}

View file

@ -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

View file

@ -1147,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 { };