Skip to content

Commit

Permalink
treewide: Remove IFDs
Browse files Browse the repository at this point in the history
Relates to:
 - #24
 - #39
 - #40
  • Loading branch information
lorenzleutgeb committed Aug 24, 2023
1 parent 0893452 commit bb5c6ba
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix flake check --allow-import-from-derivation
- run: nix flake check
8 changes: 6 additions & 2 deletions all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
kikit = callPackage ./pkgs/kikit {};
lcrq = callPackage ./pkgs/lcrq {};
lcsync = callPackage ./pkgs/lcsync {inherit lcrq librecast;};
liberaforms = callPackage ./pkgs/liberaforms {};
liberaforms-env = callPackage ./pkgs/liberaforms/env.nix {};

# LiberaForms is intentionally disabled.
# Refer to <https://github.com/ngi-nix/ngipkgs/issues/40>.
#liberaforms = callPackage ./pkgs/liberaforms {};
#liberaforms-env = callPackage ./pkgs/liberaforms/env.nix {};

libgnunetchat = callPackage ./pkgs/libgnunetchat {};
librecast = callPackage ./pkgs/librecast {inherit lcrq;};
pretalx-mysql = callPackage ./pkgs/pretalx {
Expand Down
5 changes: 4 additions & 1 deletion configs/all-configurations.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
liberaforms-container = import ./liberaforms/container.nix;
# LiberaForms is intentionally disabled.
# Refer to <https://github.com/ngi-nix/ngipkgs/issues/40>.
#liberaforms-container = import ./liberaforms/container.nix;

pretalx-postgresql = {
imports = [
./pretalx/pretalx.nix
Expand Down
4 changes: 3 additions & 1 deletion modules/all-modules.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
liberaforms = import ./liberaforms.nix;
# LiberaForms is intentionally disabled.
# Refer to <https://github.com/ngi-nix/ngipkgs/issues/40>.
#liberaforms = import ./liberaforms.nix;
pretalx = import ./pretalx.nix;
}
10 changes: 10 additions & 0 deletions pkgs/kikit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# KiKit

## Dependencies

### Shapely

KiKit depends on an outdated version of Shapely, see
<https://github.com/yaqwsx/KiKit/issues/574>.

The files in `/pkgs/kikit/shapely` were copied from [nixpkgs at revision `8d8e62e`](https://github.com/NixOS/nixpkgs/tree/8d8e62e74f511160a599471549a98bc9e4f4818d) and slightly adapted and reformatted.
16 changes: 1 addition & 15 deletions pkgs/kikit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,8 @@
}: let
properCaseName = "KiKit";

shapely = callPackage ./shapely {};
solidpython = callPackage ./solidpython {};

# https://github.com/yaqwsx/KiKit/issues/574
shapelyPkgsRoot = fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "8d8e62e74f511160a599471549a98bc9e4f4818d";
sha256 = "sha256-2vm6IAnaCo5KAA5/rWSb6dzJsS/raEqR93xbM2/jgng=";
};

shapelyFile = "${shapelyPkgsRoot}/pkgs/development/python-modules/shapely";

shapely =
python3.pkgs.callPackage
shapelyFile
{};
in
python3.pkgs.buildPythonPackage rec {
pname = lib.toLower properCaseName;
Expand Down
67 changes: 67 additions & 0 deletions pkgs/kikit/shapely/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
pkgs,
lib,
stdenv,
fetchPypi,
substituteAll,
python3,
}:
python3.pkgs.buildPythonPackage rec {
pname = "Shapely";
version = "1.8.4";
disabled = python3.pkgs.pythonOlder "3.6";

src = fetchPypi {
inherit pname version;
sha256 = "sha256-oZXlHKr6IYKR8suqP+9p/TNTyT7EtlsqRyLEz0DDGYw=";
};

nativeBuildInputs = with pkgs; [
pkgs.geos # for geos-config
python3.pkgs.cython
];

propagatedBuildInputs = with python3.pkgs; [
numpy
];

checkInputs = with python3.pkgs; [
pytestCheckHook
];

# Environment variable used in shapely/_buildcfg.py
GEOS_LIBRARY_PATH = "${pkgs.geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}";

patches = [
# Patch to search form GOES .so/.dylib files in a Nix-aware way
(substituteAll {
src = ./library-paths.patch;
libgeos_c = GEOS_LIBRARY_PATH;
libc = lib.optionalString (!stdenv.isDarwin) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6";
})
];

preCheck = ''
rm -r shapely # prevent import of local shapely
'';

disabledTests = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# FIXME(lf-): these logging tests are broken, which is definitely our
# fault. I've tried figuring out the cause and failed.
#
# It is apparently some sandbox or no-sandbox related thing on macOS only
# though.
"test_error_handler_exception"
"test_error_handler"
"test_info_handler"
];

pythonImportsCheck = ["shapely"];

meta = with lib; {
description = "Geometric objects, predicates, and operations";
homepage = "https://pypi.python.org/pypi/Shapely/";
license = with licenses; [bsd3];
maintainers = with maintainers; [knedlsepp];
};
}
31 changes: 31 additions & 0 deletions pkgs/kikit/shapely/library-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/shapely/geos.py b/shapely/geos.py
index 88c5f53..1ccd6e4 100644
--- a/shapely/geos.py
+++ b/shapely/geos.py
@@ -96,6 +96,7 @@ if sys.platform.startswith('linux'):
alt_paths = [
'libgeos_c.so.1',
'libgeos_c.so',
+ '@libgeos_c@',
]
_lgeos = load_dll('geos_c', fallbacks=alt_paths)

@@ -160,6 +161,7 @@ elif sys.platform == 'darwin':
"/usr/local/lib/libgeos_c.dylib",
# homebrew Apple Silicon
"/opt/homebrew/lib/libgeos_c.dylib",
+ "@libgeos_c@",
]
_lgeos = load_dll('geos_c', fallbacks=alt_paths)

diff --git a/tests/test_dlls.py b/tests/test_dlls.py
index c71da8e..c36262c 100644
--- a/tests/test_dlls.py
+++ b/tests/test_dlls.py
@@ -18,4 +18,5 @@ class LoadingTestCase(unittest.TestCase):
'/opt/homebrew/lib/libgeos_c.dylib', # homebrew (macOS)
os.path.join(sys.prefix, "lib", "libgeos_c.so"), # anaconda (Linux)
'libgeos_c.so.1',
- 'libgeos_c.so'])
+ 'libgeos_c.so',
+ '@libgeos_c@'])
28 changes: 6 additions & 22 deletions pkgs/kikit/solidpython/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,6 @@
}: let
inherit (python3.pkgs) buildPythonPackage;

# https://github.com/SolidCode/SolidPython/issues/207
prettytablePkgsRoot = fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "6dda65e8da23cc123060e3f24723471a15b3f0cd";
sha256 = "sha256-1zdXZIs5C81slD+nLeIk5j+O/aAujejbiW4g07JHU5s=";
};

prettytableFile = "${prettytablePkgsRoot}/pkgs/development/python-modules/prettytable";

prettytable =
python3.pkgs.callPackage
prettytableFile
{
# stdenv seems to have moved since then. Shim something that'll make this
# old version of prettytable happy.
stdenv = {
inherit lib;
};
};

pypng = python3.pkgs.pypng.overrideAttrs (old: rec {
version = "0.0.19";
src = fetchFromGitLab {
Expand Down Expand Up @@ -62,13 +41,18 @@ in
hash = "sha256-3fJta2a5c8hV9FPwKn5pj01aBtsCGSRCz3vvxR/5n0Q=";
};

patches = [
# Unpin PrettyTable, see <https://github.com/SolidCode/SolidPython/issues/207>.
./prettytable.patch
];

propagatedBuildInputs = with python3.pkgs;
[
ply
prettytable
setuptools
]
++ [
prettytable
euclid3
pypng
];
Expand Down
12 changes: 12 additions & 0 deletions pkgs/kikit/solidpython/prettytable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/pyproject.toml b/pyproject.toml
index 8b31bb7..0e2d0e0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -36,7 +36,7 @@ packages=[
python = ">=3.7"
euclid3 = "^0.1.0"
pypng = "^0.0.19"
-PrettyTable = "=0.7.2"
+PrettyTable = "*"
ply = "^3.11"
setuptools = ">=65.6.3"

0 comments on commit bb5c6ba

Please sign in to comment.