diff --git a/flake.nix b/flake.nix index 32debe8..429c8bc 100644 --- a/flake.nix +++ b/flake.nix @@ -14,12 +14,6 @@ let pkgs = nixpkgs.legacyPackages.${system}; - # osm-data = pkgs.fetchurl { - # url = - # "https://static.home.all-dressed-programming.com/download.geofabrik.de/north-america/canada/quebec-241223.osm.pbf"; - # hash = "sha256-JkDJxODHnZQLK4+5Bjdu5GkbmHSK9TPt2ep6nsykCRg="; - # }; - poly2geojson = pkgs.rustPlatform.buildRustPackage rec { pname = "poly2geojson"; version = "0.1.3"; @@ -72,12 +66,42 @@ ]; doCheck = false; + doInstallCheck = false; postInstall = '' installShellCompletion --zsh ../zsh_completion/_osmium ''; }; + duckdb-spatial = pkgs.clangStdenv.mkDerivation rec { + pname = "duckdb-spatial"; + version = "master"; + + src = pkgs.fetchFromGitHub { + owner = "duckdb"; + repo = "duckdb-spatial"; + rev = "7f861c037567dadaeff9cb5dcde4e5f2e87a4e14"; + sha256 = "sha256-8kfNofzbmPJ7+qKKzsr7LVu1mMDwGhy5nQj6/kRhYLg="; + }; + librarySystemDepends = [ pkgs.zlib ]; + executableSystemDepends = [ pkgs.zlib ]; + + cmakeFlags = + [ "-DVCPKG_TARGET_TRIPLET=${system}" "-DSPATIAL_USE_NETWORK=0" ]; + + nativeBuildInputs = with pkgs; [ + cmake + installShellFiles + pandoc + pkg-config + zlib + ]; + + buildInputs = with pkgs; [ geographiclib openssl geos curl zlib ]; + + doCheck = false; + }; + geofabrik-base-url = "https://static.home.all-dressed-programming.com/download.geofabrik.de/north-america/canada/"; @@ -119,7 +143,7 @@ mkdir -p cities/canada/quebec cp ${quebec-cities-poly}/canada/quebec/* cities/canada/quebec chmod u+w cities/canada/quebec - ${pkgs.babashka}/bin/bb to-geojson.clj --osm-file ${osm-data} --paths cities/canada/quebec/mon*.poly + ${pkgs.babashka}/bin/bb to-geojson.clj --osm-file ${osm-data} --paths cities/canada/quebec/*.poly ''; installPhase = '' cp -r cities $out @@ -152,10 +176,10 @@ ]); in { packages = { - default = data-dir; + default = historical-data-dir; poly2geojson = poly2geojson; osmosis = osmosis; - historical-data-dir = historical-data-dir; + duckdb-spatial = duckdb-spatial; }; devShell = pkgs.mkShell { name = "spacial-data-experiments"; @@ -167,6 +191,8 @@ gdal custom-osmium-tool python-virtual-env + dotnet-sdk_8 + nuget-to-nix ]; }; }); diff --git a/scripts/to-geojson.clj b/scripts/to-geojson.clj index d0cce53..a36a8be 100644 --- a/scripts/to-geojson.clj +++ b/scripts/to-geojson.clj @@ -24,7 +24,7 @@ cmd (osmium-command osm-file poly-file output-file)] (println "Processing " poly-file " file to " output-file) (println cmd) - (apply shell (into [{:continue false}] cmd)))) + (apply shell (into [{:continue true}] cmd)))) (def opts (cli/parse-opts *command-line-args* {:coerce {:paths []}}))