-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
/
package.nix
97 lines (84 loc) · 2.43 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
lib,
python3Packages,
fetchFromGitHub,
writeText,
copyDesktopItems,
makeDesktopItem,
makeWrapper,
onedrive,
}:
let
version = "1.1.0";
setupPy = writeText "setup.py" ''
from setuptools import setup
setup(
name='onedrivegui',
version='${version}',
scripts=[
'src/OneDriveGUI.py',
],
)
'';
in
python3Packages.buildPythonApplication rec {
pname = "onedrivegui";
inherit version;
src = fetchFromGitHub {
owner = "bpozdena";
repo = "OneDriveGUI";
rev = "v${version}";
hash = "sha256-d5NAcT3x9R/2DVQKZsw4GH63nTlVFsvkWwMrb42s18s=";
};
nativeBuildInputs = [
copyDesktopItems
makeWrapper
];
propagatedBuildInputs = with python3Packages; [
pyside6
requests
];
# wrap manually to avoid having a bash script in $out/bin with a .py extension
dontWrapPythonPrograms = true;
doCheck = false; # No tests defined
pythonImportsCheck = [ "OneDriveGUI" ];
desktopItems = [
(makeDesktopItem {
name = "OneDriveGUI";
exec = "onedrivegui";
desktopName = "OneDriveGUI";
comment = "OneDrive GUI Client";
type = "Application";
icon = "OneDriveGUI";
terminal = false;
categories = [ "Utility" ];
})
];
postPatch = ''
# Patch OneDriveGUI.py so DIR_PATH points to shared files location
sed -i src/OneDriveGUI.py -e "s@^DIR_PATH =.*@DIR_PATH = '$out/share/OneDriveGUI'@"
cp ${setupPy} ${setupPy.name}
'';
postInstall = ''
mkdir -p $out/share/OneDriveGUI
# we do not need the `ui` directory - only resources
cp -r src/resources $out/share/OneDriveGUI
install -Dm444 -t $/out/share/icons/hicolor/48x48/apps src/resources/images/OneDriveGUI.png
# we put our own executable wrapper in place instead
rm -r $out/bin/*
makeWrapper ${python3Packages.python.interpreter} $out/bin/onedrivegui \
--prefix PATH : ${lib.makeBinPath [ onedrive ]} \
--prefix PYTHONPATH : ${
python3Packages.makePythonPath (propagatedBuildInputs ++ [ (placeholder "out") ])
} \
--add-flags $out/${python3Packages.python.sitePackages}/OneDriveGUI.py
'';
meta = with lib; {
homepage = "https://github.com/bpozdena/OneDriveGUI";
description = "Simple GUI for Linux OneDrive Client, with multi-account support";
mainProgram = "onedrivegui";
license = licenses.gpl3Only;
maintainers = with maintainers; [ chewblacka ];
platforms = platforms.linux;
};
}