blob: db526835872b1e73e8a2af40f7f40052bae12e94 [file] [log] [blame]
Skyler Grey77d1fbf2023-01-26 00:43:49 +00001{ 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;
11in stdenv.mkDerivation {
Skyler Greyf4c2e672022-10-31 00:29:45 +000012 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 Grey77d1fbf2023-01-26 00:43:49 +000030 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 Greyf4c2e672022-10-31 00:29:45 +000034 ${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}