Add thingiverse-downloader

Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
magic_rb 2024-02-11 01:07:59 +01:00
parent b0fb438ce9
commit 7de31b611c
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
4 changed files with 47 additions and 0 deletions

View file

@ -109,6 +109,7 @@ in {
cura
super-slicer
prusa-slicer
thingiverse-downloader-bash
inkscape

View file

@ -15,6 +15,7 @@
rolling_datasets
virtiofsd-zfs
ledger-compat
thingiverse-downloader
])
++
(with inputs'.nixng.overlays; [

View file

@ -0,0 +1,18 @@
{inputs, ...}: {
flake.overlays.thingiverse-downloader = final: prev: {
thingiverse-downloader-bash = final.writeShellScriptBin "thingiverse-downloader" ''
THING_ID="$1"
curl https://www.thingiverse.com/thing:$THING_ID/zip -OL
unzip zip
( echo ; curl "https://api.thingiverse.com/things/$THING_ID?access_token=$THINGIVERSE_API_TOKEN" | \
${final.lib.getExe final.jq} '.description' -r ) >> README.txt
rm zip
'';
thingiverse-downloader = final.callPackage ./thingiverse-downloader.nix {
inherit
(inputs)
thingiverse-downloader
;
};
};
}

View file

@ -0,0 +1,27 @@
{
python3,
lib,
thingiverse-downloader,
}:
python3.pkgs.buildPythonApplication rec {
pname = "thingiverse-downloader";
version = "unknown";
format = "other";
src = thingiverse-downloader;
installPhase = ''
mkdir -p $out/bin
echo "#!/bin/python3" | cat - $src/thingiverse_downloader.py > $out/bin/thingiverse-downloader
chmod +x $out/bin/thingiverse-downloader
wrapProgram $out/bin/thingiverse-downloader \
--prefix PYTHONPATH : "$PYTHONPATH"
'';
propagatedBuildInputs = with python3.pkgs; [
requests
];
meta = with lib; {
};
}