mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
Add thingiverse-downloader
Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
parent
b0fb438ce9
commit
7de31b611c
|
@ -109,6 +109,7 @@ in {
|
|||
cura
|
||||
super-slicer
|
||||
prusa-slicer
|
||||
thingiverse-downloader-bash
|
||||
|
||||
inkscape
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
rolling_datasets
|
||||
virtiofsd-zfs
|
||||
ledger-compat
|
||||
thingiverse-downloader
|
||||
])
|
||||
++
|
||||
(with inputs'.nixng.overlays; [
|
||||
|
|
18
overlays/thingiverse-downloader/default.nix
Normal file
18
overlays/thingiverse-downloader/default.nix
Normal 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
|
||||
;
|
||||
};
|
||||
};
|
||||
}
|
27
overlays/thingiverse-downloader/thingiverse-downloader.nix
Normal file
27
overlays/thingiverse-downloader/thingiverse-downloader.nix
Normal 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; {
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue