Skyler Grey | 77d1fbf | 2023-01-26 00:43:49 +0000 | [diff] [blame] | 1 | { stdenv, p7zip, zip, python3, qt5 }: let |
| 2 | preExec = '' |
| 3 | import os |
| 4 | sfs_select_dir = os.path.expanduser('~/.local/share/Steam/sfs-select/runtime') |
| 5 | os.makedirs(sfs_select_dir, exist_ok=True) |
| 6 | os.chdir(sfs_select_dir) |
| 7 | |
| 8 | |
| 9 | ''; |
| 10 | preExecBash = builtins.replaceStrings ["\n"] ["\\n"] preExec; |
| 11 | in stdenv.mkDerivation { |
Skyler Grey | f4c2e67 | 2022-10-31 00:29:45 +0000 | [diff] [blame] | 12 | pname = "sfs-select"; |
| 13 | version = "0.5.0"; |
| 14 | |
| 15 | src = builtins.fetchurl { |
| 16 | url = "https://www.unix-ag.uni-kl.de/~t_schmid/sfs-select/sfs-select-0.5.0-full.7z"; |
| 17 | sha256 = "sha256:130ks9vc33r9aycbbz3i8agcy7gjijmfvv94pd4ndxmwl2ndmrh2"; |
| 18 | }; |
| 19 | unpackPhase = '' |
| 20 | runHook preUnpack |
| 21 | |
| 22 | ${p7zip}/bin/7z x $src -o. -y |
| 23 | |
| 24 | runHook postUnpack |
| 25 | ''; |
| 26 | |
| 27 | buildPhase = '' |
| 28 | runHook preBuild |
| 29 | |
Skyler Grey | 77d1fbf | 2023-01-26 00:43:49 +0000 | [diff] [blame] | 30 | mv ./sfs-select/python/sfs-select.py ./sfs-select/python/__main__.py |
| 31 | |
| 32 | |
| 33 | sed -i "1i${preExecBash}" ./sfs-select/python/__main__.py |
Skyler Grey | f4c2e67 | 2022-10-31 00:29:45 +0000 | [diff] [blame] | 34 | ${zip}/bin/zip -rj sfs-select.zip ./sfs-select/python/* |
| 35 | |
| 36 | runHook postBuild |
| 37 | ''; |
| 38 | |
| 39 | installPhase = '' |
| 40 | runHook preBuild |
| 41 | |
| 42 | mkdir -p $out/bin |
| 43 | |
| 44 | echo '#!/usr/bin/env python' | cat - sfs-select.zip > $out/bin/sfs-select |
| 45 | |
| 46 | chmod +x $out/bin/sfs-select |
| 47 | |
| 48 | makeWrapperArgs+=("''${qtWrapperArgs[@]}") |
| 49 | wrapQtApp $out/bin/sfs-select $makeWrapperArgs |
| 50 | |
| 51 | runHook postBuild |
| 52 | ''; |
| 53 | |
| 54 | nativeBuildInputs = [ p7zip zip qt5.wrapQtAppsHook ]; |
| 55 | buildInputs = [ |
| 56 | (python3.withPackages (pythonPackages: with pythonPackages; [ |
| 57 | psutil |
| 58 | pyqt5 |
| 59 | ])) |
| 60 | ]; |
| 61 | dontWrapQtApps = true; |
| 62 | } |