diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2026-05-31 15:11:59 +0200 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2026-05-31 15:11:59 +0200 |
| commit | 205ee4aaf4a3fa733e83305b4b1c92a629ce8ca7 (patch) | |
| tree | 25afd7bbf66ecc222f25a37c0584d16e8abe3205 /devenv.nix | |
| download | ade-dedrm-master.tar.gz ade-dedrm-master.tar.bz2 ade-dedrm-master.tar.xz | |
Diffstat (limited to 'devenv.nix')
| -rw-r--r-- | devenv.nix | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..7aa21db --- /dev/null +++ b/devenv.nix @@ -0,0 +1,115 @@ +{ inputs, pkgs, config, ... }: +{ + # to install ADE and extract its key, run the following scripts + # wine-setup + # python-install + # ade-install + # dedrm-install + # extract-key + + # sources: + # https://baptiste.bouchereau.pro/tutorial/read-ade-protected-ebooks-on-linux/#setup-the-calibre-plugin + # https://gist.github.com/rendyanthony/a1d6b830c33a5e0fcd8b4c86f3f0dbff + + packages = with pkgs; [ + # for installing ADE and extracting its key + wget wine winetricks gnutls + # for calibre + calibre + ]; + + env = { + WINEPREFIX = "${config.env.DEVENV_ROOT}/wine"; + WINEARCH = "win32"; + PYTHONVERSION = "3.12.8"; + ADEVERSION = "2.0"; + DEDRMVERSION = "10.0.3"; + DEDRM = "${config.env.DEVENV_ROOT}/DeDRM"; + }; + + scripts = { + wine-rm.exec = '' + rm -rf "$WINEPREFIX" + ''; + + wine-setup.exec = '' + echo ============================================================ + echo Setting up Wine environment... + echo ============================================================ + mkdir -p $WINEPREFIX + wineboot + winetricks -q corefonts + winetricks -q dotnet35sp1 + winetricks -q python + echo ============================== + echo Wine environment set up! + echo ============================== + ''; + + python-install.exec = '' + echo ============================================================ + echo Downloading Python installer... + echo ============================================================ + wget "https://www.python.org/ftp/python/$PYTHONVERSION/python-$PYTHONVERSION.exe" -O "$WINEPREFIX"/python.exe + echo ============================================================ + echo Installing Python inside Wine... + echo The graphical installer will open next. + echo MAKE SURE TO SELECT '"add python.exe to PATH"'! + echo You can always rerun the Python install with "'python-install'" + read -p "Press ENTER to start to installing python." + echo ============================================================ + wine "$WINEPREFIX"/python.exe + wine python -m pip install pycryptodome + echo ============================================================ + echo Python installed! + echo ============================================================ + ''; + + + ade-install.exec = '' + echo ============================================================ + echo Downloading ADE installer... + echo ============================================================ + wget http://download.adobe.com/pub/adobe/digitaleditions/ADE_"$ADEVERSION"_Installer.exe -O "$WINEPREFIX/ADE.exe" + echo ============================================================ + echo Installing ADE inside Wine... + echo The graphical installer will open next. + echo Once the installation is complete, ADE will start. + echo MAKE SURE TO AUTHORIZE YOUR WINE ENVIRONMENT + echo IN '"Help > Authorize your computer"' + echo You can always rerun the ADE install with "'ade-install'", + echo and you can launch ADE with "'ade'". + read -p "Press ENTER to start to installing ADE." + echo ============================================================ + wine $WINEPREFIX/ADE.exe + echo ============================================================ + echo ADE installed! + echo ============================================================ + ''; + + ade.exec = '' + wine "$WINEPREFIX/drive_c/Program Files/Adobe/Adobe Digital Editions $ADEVERSION/DigitalEditions.exe" + ''; + + dedrm-install.exec = '' + echo ============================================================ + echo Downloading and extracting DeDRM script... + echo ============================================================ + wget "https://github.com/noDRM/DeDRM_tools/releases/download/v$DEDRMVERSION/DeDRM_tools_$DEDRMVERSION.zip" -O "$WINEPREFIX/DeDRM.zip" + unzip "$WINEPREFIX/DeDRM.zip" -d "$DEDRM" + unzip "$WINEPREFIX/DeDRM/DeDRM_plugin.zip" -d "$DEDRM/DeDRM_plugin" + ''; + + extract-key.exec = '' + echo ============================================================ + echo Extracting ADE key... + echo ============================================================ + wine python "$DEDRM/DeDRM_plugin/adobekey.py" + ln -sf "$WINEPREFIX/DeDRM_plugin/*.der adobekey.der" + echo ============================================================ + echo ADE key extracted to "'$DEVENV_ROOT/adobekey.der'"! + echo Check out the links in "'devenv.nix'" for what to do next. + echo ============================================================ + ''; + }; +} |
