packages,shells: add axidraw

This commit is contained in:
Artemis Tosini 2024-01-15 15:55:17 +00:00
parent 195c2e4d1c
commit efb6657ea2
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
5 changed files with 146 additions and 7 deletions

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1702900294, "lastModified": 1705204527,
"narHash": "sha256-pt7sSoJYNw3n8YtXw0Z/Nnr6/PfY2YrjDvqboErXnRM=", "narHash": "sha256-WVz9WdaFBhAwO/7A+HlW8HPJ4VQ8QnpCD1WZAcAPneo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "886c9aee6ca9324e127f9c2c4e6f68c2641c8256", "rev": "dd5621df6dcb90122b50da5ec31c411a0de3e538",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -13,18 +13,50 @@
inherit system; inherit system;
overlays = [ self.overlays.default ]; overlays = [ self.overlays.default ];
}; };
inherit (pkgs) lib;
names = builtins.attrNames (self.overlays.default pkgs pkgs);
in { in {
devShells = { zephyr = pkgs.callPackage ./shells/zephyr { }; }; devShells = {
axidraw = pkgs.callPackage ./shells/axidraw { };
zephyr = pkgs.callPackage ./shells/zephyr { };
};
formatter = pkgs.nixfmt; formatter = pkgs.nixfmt;
packages = self.overlays.default pkgs pkgs; packages = builtins.listToAttrs (lib.concatMap (name:
let pkg = pkgs.${name};
in lib.optional (builtins.typeOf pkg == "set") {
inherit name;
value = if lib.isDerivation pkg then
pkg
else
pkg // {
type = "derivation";
name = "dummy-attrset";
};
}) names);
}) // { }) // {
overlays.default = final: prev: { overlays.default = final: prev: {
jlink = final.callPackage ./packages/jlink { };
ipsw = final.callPackage ./packages/ipsw { }; ipsw = final.callPackage ./packages/ipsw { };
jlink = final.callPackage ./packages/jlink { };
zephyrPackages = final.callPackage ./packages/zephyr { };
inherit (final.python3.pkgs) axicli;
inkscape-extensions = prev.inkscape-extensions // {
axidraw = final.callPackage ./packages/axidraw/inkscape.nix { };
};
kernelPatches = prev.kernelPatches kernelPatches = prev.kernelPatches
// final.callPackage ./packages/kernelPatches { }; // final.callPackage ./packages/kernelPatches { };
zephyrPackages = final.callPackage ./packages/zephyr { };
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(pythonFinal: pythonPrev: {
inherit (final.callPackage ./packages/axidraw/modules.nix {
inherit pythonFinal pythonPrev;
})
ink-extensions plotink axidrawinternal axicli;
})
];
}; };
}; };
} }

View file

@ -0,0 +1,32 @@
{ stdenv, lib, fetchzip, autoPatchelfHook }:
stdenv.mkDerivation rec {
pname = "axidraw-inkscape";
version = "394";
src = fetchzip {
url =
"https://cdn.evilmadscientist.com/dl/ad/public/${version}/AxiDraw_${version}_LinX86.zip";
hash = "sha256-LoNi7mR30spELnEYikRuYFvlgUWP3w8KRbQ6Ug108vU=";
};
nativeBuildInputs = [ autoPatchelfHook ];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/share/inkscape/extensions"
cp -rt "$out/share/inkscape/extensions" *.py *.inx axidraw_deps build_deps svg_fonts
runHook postInstall
'';
meta = with lib; {
description = "Inkscape extension for managing axidraw";
homepage =
"https://wiki.evilmadscientist.com/Axidraw_Software_Installation";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ artemist ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,65 @@
{ pythonFinal, pythonPrev, fetchPypi, fetchzip }:
let
inherit (pythonFinal) buildPythonPackage;
axicliVersion = "3.9.0";
axicliVer = builtins.replaceStrings [ "." ] [ "" ] axicliVersion;
axicliSrc = fetchzip {
url =
"https://github.com/evil-mad/axidraw/releases/download/v${axicliVersion}/AxiDraw_API_${axicliVer}.zip";
hash = "sha256-RPh00jiiH1RqqKZ10ylFP1J+iBYl5VOmZ8g0vFH8Ibg=";
};
in {
ink-extensions = buildPythonPackage rec {
pname = "ink_extensions";
version = "1.3.2";
src = fetchPypi {
inherit pname version;
hash = "sha256-9dPmoLBhIoJGBaQwOtGMZnOS9mGGel13dQXkaJdexyc=";
};
propagatedBuildInputs = with pythonFinal; [ lxml ];
};
plotink = buildPythonPackage rec {
pname = "plotink";
version = "1.8.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-YxSASXBNXqRyGp7x6jlTU0UYJHJkiKdlEzfDMzUtKXk=";
};
doCheck = false;
propagatedBuildInputs = with pythonFinal; [ ink-extensions pyserial ];
};
axidrawinternal = buildPythonPackage {
pname = "axidrawinternal";
version = axicliVersion;
format = "wheel";
src =
"${axicliSrc}/prebuilt_dependencies/axidrawinternal-${axicliVersion}-py2.py3-none-any.whl";
propagatedBuildInputs = with pythonFinal; [
ink-extensions
requests
packaging
plotink
pyclipper
tqdm
];
};
axicli = buildPythonPackage {
pname = "axicli";
version = axicliVersion;
format = "setuptools";
src = axicliSrc;
doCheck = false;
propagatedBuildInputs = with pythonFinal; [
ink-extensions
lxml
plotink
pyserial
requests
axidrawinternal
];
};
}

View file

@ -0,0 +1,10 @@
{ lib, mkShell, python3, inkscape-with-extensions, inkscape-extensions }:
mkShell {
packages = [
(inkscape-with-extensions.override {
inkscapeExtensions = [ inkscape-extensions.axidraw ];
})
python3
] ++ (with python3.pkgs; [ ipython requests axicli ]);
}