bump
This commit is contained in:
parent
9fdc31b856
commit
8dcede922b
5 changed files with 112 additions and 58 deletions
40
modules/desktop/book.nix
Normal file
40
modules/desktop/book.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "book";
|
||||
runtimeInputs = with pkgs; [
|
||||
libgourou
|
||||
calibre
|
||||
];
|
||||
text = ''
|
||||
input="$1"
|
||||
|
||||
if [ -f "$input" ] && echo "$input" | grep -qi "\.epub$"; then
|
||||
fullpath="$input"
|
||||
else
|
||||
if [ ! -d "$HOME/.config/adept" ]; then
|
||||
adept_activate --anonymous
|
||||
fi
|
||||
|
||||
fullpath=$(acsmdownloader --output-dir /tmp "$input" \
|
||||
| tee /dev/tty \
|
||||
| grep "^Created " \
|
||||
| sed "s/^Created //")
|
||||
|
||||
adept_remove "$fullpath"
|
||||
fi
|
||||
|
||||
name=$(basename "$fullpath" | rev | cut -d. -f2- | rev)
|
||||
ext=$(echo "$fullpath" | rev | cut -d. -f1 | rev)
|
||||
|
||||
if [ "$ext" = "epub" ]; then
|
||||
ebook-convert "$fullpath" "/run/media/quadradical/Kindle/documents/$name.mobi"
|
||||
rm $fullpath"
|
||||
else
|
||||
mv "$fullpath" "/run/media/quadradical/Kindle/documents/$name.pdf"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
@ -8,5 +8,6 @@
|
|||
libreoffice
|
||||
authenticator
|
||||
prismlauncher
|
||||
nexusmods-app-unfree
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue