blob: 2492d8f601ef3d8fb24de76dbd3255cd2f06fe89 [file] [log] [blame]
Skyler Grey1909a0b2023-05-03 20:33:53 +00001{ stdenv, p7zip, zip, python3, qt5 }:
2let
Skyler Grey77d1fbf2023-01-26 00:43:49 +00003 preExec = ''
Skyler Grey1909a0b2023-05-03 20:33:53 +00004 import os
5 sfs_select_dir = os.path.expanduser('~/.local/share/Steam/sfs-select/runtime')
6 os.makedirs(sfs_select_dir, exist_ok=True)
7 os.chdir(sfs_select_dir)
Skyler Grey77d1fbf2023-01-26 00:43:49 +00008
9
10 '';
Skyler Grey1909a0b2023-05-03 20:33:53 +000011 preExecBash = builtins.replaceStrings [ "\n" ] [ "\\n" ] preExec;
12in
13stdenv.mkDerivation {
Skyler Greyf4c2e672022-10-31 00:29:45 +000014 pname = "sfs-select";
15 version = "0.5.0";
16
17 src = builtins.fetchurl {
18 url = "https://www.unix-ag.uni-kl.de/~t_schmid/sfs-select/sfs-select-0.5.0-full.7z";
19 sha256 = "sha256:130ks9vc33r9aycbbz3i8agcy7gjijmfvv94pd4ndxmwl2ndmrh2";
20 };
21 unpackPhase = ''
22 runHook preUnpack
23
24 ${p7zip}/bin/7z x $src -o. -y
25
26 runHook postUnpack
27 '';
28
29 buildPhase = ''
30 runHook preBuild
31
Skyler Grey77d1fbf2023-01-26 00:43:49 +000032 mv ./sfs-select/python/sfs-select.py ./sfs-select/python/__main__.py
33
34
35 sed -i "1i${preExecBash}" ./sfs-select/python/__main__.py
Skyler Greyf4c2e672022-10-31 00:29:45 +000036 ${zip}/bin/zip -rj sfs-select.zip ./sfs-select/python/*
37
38 runHook postBuild
39 '';
40
41 installPhase = ''
42 runHook preBuild
43
44 mkdir -p $out/bin
45
46 echo '#!/usr/bin/env python' | cat - sfs-select.zip > $out/bin/sfs-select
47
48 chmod +x $out/bin/sfs-select
49
Skyler Grey78731412023-05-02 13:20:14 +000050 wrapQtApp $out/bin/sfs-select
Skyler Greyf4c2e672022-10-31 00:29:45 +000051
52 runHook postBuild
53 '';
54
55 nativeBuildInputs = [ p7zip zip qt5.wrapQtAppsHook ];
56 buildInputs = [
57 (python3.withPackages (pythonPackages: with pythonPackages; [
58 psutil
59 pyqt5
60 ]))
61 ];
62 dontWrapQtApps = true;
63}