nixpkgs/pkgs/by-name/ge/gerbolyze/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

104 lines
2.5 KiB
Nix

{
lib,
stdenv,
python3Packages,
fetchFromGitHub,
gitUpdater,
resvg,
}:
let
version = "3.1.9";
src = fetchFromGitHub {
owner = "jaseg";
repo = "gerbolyze";
rev = "v${version}";
hash = "sha256-bisLln3Y239HuJt0MkrCU+6vLLbEDxfTjEJMkcbE/wE=";
fetchSubmodules = true;
};
svg-flatten = stdenv.mkDerivation rec {
inherit version src;
pname = "svg-flatten";
sourceRoot = "${src.name}/svg-flatten";
postPatch = ''
substituteInPlace Makefile \
--replace "$(INSTALL) $(BUILDDIR)/$(BINARY) $(PREFIX)/bin" \
"$(INSTALL) $(BUILDDIR)/$(BINARY) $(PREFIX)/bin/svg-flatten" \
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
PREFIX=$out make install
runHook postInstall
'';
meta = with lib; {
description = "svg-flatten SVG downconverter";
homepage = "https://github.com/jaseg/gerbolyze";
license = with licenses; [ agpl3Plus ];
maintainers = with maintainers; [ wulfsta ];
mainProgram = "svg-flatten";
platforms = platforms.linux;
};
};
in
python3Packages.buildPythonApplication rec {
inherit version src;
pname = "gerbolyze";
format = "setuptools";
nativeBuildInputs = [
python3Packages.setuptools
];
propagatedBuildInputs = [
python3Packages.beautifulsoup4
python3Packages.click
python3Packages.numpy
python3Packages.scipy
python3Packages.python-slugify
python3Packages.lxml
python3Packages.gerbonara
resvg
svg-flatten
];
preConfigure = ''
# setup.py tries to execute a call to git in a subprocess, this avoids it.
substituteInPlace setup.py \
--replace "version = get_version()," \
"version = '${version}'," \
# setup.py tries to execute a call to git in a subprocess, this avoids it.
substituteInPlace setup.py \
--replace "long_description=format_readme_for_pypi()," \
"long_description='\n'.join(Path('README.rst').read_text().splitlines()),"
'';
pythonImportsCheck = [ "gerbolyze" ];
nativeCheckInputs = [
python3Packages.pytestCheckHook
resvg
svg-flatten
];
passthru.updateScript = gitUpdater {
rev-prefix = "v";
};
meta = with lib; {
description = "Directly render SVG overlays into Gerber and Excellon files";
homepage = "https://github.com/jaseg/gerbolyze";
license = with licenses; [ agpl3Plus ];
maintainers = with maintainers; [ wulfsta ];
mainProgram = "gerbolyze";
platforms = platforms.linux;
};
}