nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

commit f41313d56a5e15ae6bb02365508e12ce603bb16e
parent a92f9559c3a8c1d05ab7b76d63815673fc4c1303
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date:   Fri,  8 Jan 2021 11:12:24 +0300

Add map-stylizer

Diffstat:
Mnix/sources.json | 14++++++++++++++
Apkgs/applications/gis/map-stylizer/config.patch | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/applications/gis/map-stylizer/default.nix | 36++++++++++++++++++++++++++++++++++++
Mpkgs/default.nix | 1+
4 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/nix/sources.json b/nix/sources.json @@ -612,6 +612,20 @@ "url": "https://github.com/slazav/map_podm/archive/59a6035fa5bd1d1a8d6544881c1d0aad4a91f315.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, + "map-stylizer": { + "branch": "master", + "builtin": false, + "date": "2020-06-30T03:06:18Z", + "description": "GUI written in Python to parse OSM (OpenStreetMap) files and render them onscreen", + "homepage": "https://github.com/Absolute-Tinkerer/map-stylizer", + "owner": "Absolute-Tinkerer", + "repo": "map-stylizer", + "rev": "6279f40408aff823a4eb1071334bd2acd10cb921", + "sha256": "0k9lng42vi0qcjwfkkd0g55g1wb7a5wz782mvc0rj8gr95shfhxx", + "type": "tarball", + "url": "https://github.com/Absolute-Tinkerer/map-stylizer/archive/6279f40408aff823a4eb1071334bd2acd10cb921.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, "map-tiler": { "branch": "master", "builtin": false, diff --git a/pkgs/applications/gis/map-stylizer/config.patch b/pkgs/applications/gis/map-stylizer/config.patch @@ -0,0 +1,58 @@ +diff --git c/main.py i/main.py +index 5164746..6a2398e 100644 +--- c/main.py ++++ i/main.py +@@ -31,13 +31,13 @@ if __name__ == '__main__': + + # Ensure we create the necesary folders if they don't exist + if not os.path.exists(c.FOLDER_DATA): +- os.mkdir(c.FOLDER_DATA) ++ os.makedirs(c.FOLDER_DATA) + if not os.path.exists(c.FOLDER_OUTPUT): +- os.mkdir(c.FOLDER_OUTPUT) ++ os.makedirs(c.FOLDER_OUTPUT) + if not os.path.exists(c.FOLDER_CONFIGS): +- os.mkdir(c.FOLDER_CONFIGS) ++ os.makedirs(c.FOLDER_CONFIGS) + if not os.path.exists(c.FOLDER_USER_CONFIGS): +- os.mkdir(c.FOLDER_USER_CONFIGS) ++ os.makedirs(c.FOLDER_USER_CONFIGS) + + # Start the program + window = MainWindowHandlers() +diff --git c/src/core/constants.py i/src/core/constants.py +index 69e53c8..1fae240 100644 +--- c/src/core/constants.py ++++ i/src/core/constants.py +@@ -19,13 +19,14 @@ connect the VAL and CONFIG_STYLE in the DATA_GROUPS dictionary + """ + + from PyQt5.QtCore import Qt ++from os.path import expanduser + + + # Resource Strings +-FOLDER_DATA = 'data' +-FOLDER_OUTPUT = 'output' +-FOLDER_CONFIGS = 'configs' +-FOLDER_USER_CONFIGS = 'configs/user' ++FOLDER_DATA = expanduser('~/.local/share/map-stylizer/data') ++FOLDER_OUTPUT = expanduser('~/.local/share/map-stylizer/output') ++FOLDER_CONFIGS = expanduser('~/.config/map-stylizer/configs') ++FOLDER_USER_CONFIGS = expanduser('~/.config/map-stylizer/configs/user') + FILE_ICON = 'src/resources/icon.png' + FILE_CONFIG = 'user.config' + +diff --git c/src/gui/MainWindow/MainWindowHandlers.py i/src/gui/MainWindow/MainWindowHandlers.py +index 2e491d6..c2223bc 100644 +--- c/src/gui/MainWindow/MainWindowHandlers.py ++++ i/src/gui/MainWindow/MainWindowHandlers.py +@@ -228,7 +228,7 @@ class MainWindowHandlers(QMainWindow): + The user has clicked the button to save the map as an image + """ + fileName, _ = QFileDialog.getSaveFileName( +- self, 'Save Image', 'output', 'Image Files (*.jpg)') ++ self, 'Save Image', 'output', 'Image Files (*.png)') + + if fileName: + self._map.saveImage(self._box_max_dim.value(), fileName) diff --git a/pkgs/applications/gis/map-stylizer/default.nix b/pkgs/applications/gis/map-stylizer/default.nix @@ -0,0 +1,36 @@ +{ lib, python3Packages, qt5, sources }: + +python3Packages.buildPythonApplication { + pname = "map-stylizer-unstable"; + version = lib.substring 0 10 sources.map-stylizer.date; + + src = sources.map-stylizer; + + patches = [ ./config.patch ]; + + dontUseSetuptoolsBuild = true; + dontUseSetuptoolsCheck = true; + + installPhase = '' + site_packages=$out/lib/${python3Packages.python.libPrefix}/site-packages + mkdir -p $site_packages + cp -r src main.py $site_packages + + substituteInPlace $site_packages/main.py \ + --replace "'src'" "'$site_packages/src'" + + substituteInPlace $site_packages/src/core/constants.py \ + --replace "src/resources" "$site_packages/src/resources" + + makeWrapper ${(python3Packages.python.withPackages (ps: [ ps.pyqt5 ])).interpreter} $out/bin/map-stylizer \ + --set QT_QPA_PLATFORM_PLUGIN_PATH ${qt5.qtbase.bin}/lib/qt-*/plugins/platforms \ + --add-flags "$site_packages/main.py" + ''; + + meta = with lib; { + inherit (sources.map-stylizer) description homepage; + license = licenses.gpl3; + maintainers = [ maintainers.sikmir ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix @@ -28,6 +28,7 @@ lib.makeScope newScope ( klogg-bin = callPackage ./applications/misc/klogg/bin.nix { }; librewolf = callPackage ./applications/networking/librewolf { }; macpass-bin = callPackage ./applications/macpass/bin.nix { }; + map-stylizer = callPackage ./applications/gis/map-stylizer { }; maperitive-bin = callPackage ./applications/gis/maperitive/bin.nix { }; mapsoft = callPackage ./applications/gis/mapsoft { }; mapsoft2 = callPackage ./applications/gis/mapsoft/2.nix { };