diff options
author | John Garcia <jgarcia3788@yahoo.co.uk> | 2023-10-05 18:14:56 +0100 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2023-10-23 16:31:30 +0000 |
commit | a2f9450f851c5aa49db37c275e04a2a1696dfbdb (patch) | |
tree | 2c54241494456fce7acc315def68451da669fb8c /pkgs | |
parent | 8970fe57a70128bb5447967a69213f6415ea3cb5 (diff) |
onedrivegui: init at 1.0.3
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/by-name/on/onedrivegui/package.nix | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/pkgs/by-name/on/onedrivegui/package.nix b/pkgs/by-name/on/onedrivegui/package.nix new file mode 100644 index 0000000000000..6ffd81584f3e7 --- /dev/null +++ b/pkgs/by-name/on/onedrivegui/package.nix @@ -0,0 +1,87 @@ +{ lib +, python3Packages +, fetchFromGitHub +, writeText +, copyDesktopItems +, makeDesktopItem +, makeWrapper +, onedrive +}: + +let + version = "1.0.3"; + + 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-HutziAzhIDYP8upNPieL2GNrxPBHUCVs09FFxdSqeBs="; + }; + + 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/lib/${python3Packages.python.libPrefix}/site-packages/OneDriveGUI.py + ''; + + meta = with lib; { + homepage = "https://github.com/bpozdena/OneDriveGUI"; + description = "A simple GUI for Linux OneDrive Client, with multi-account support"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ jgarcia ]; + platforms = platforms.linux; + }; +} |