Merge pull request #529 from nix-community/minor-macos-fixes

Minor macos fixes
This commit is contained in:
adisbladis 2022-01-22 10:35:43 +12:00 committed by GitHub
commit 35f0b22424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 40 deletions

View file

@ -64,4 +64,4 @@ jobs:
with:
name: poetry2nix
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-shell -p nix-build-uncached --run 'nix-build-uncached --keep-going --show-trace tests/default.nix -A ${{ matrix.attr }}'
- run: nix-shell --run 'nix-build-uncached -build-flags "-L" --keep-going --show-trace tests/default.nix -A ${{ matrix.attr }}'

View file

@ -1,4 +1,16 @@
{
"nix-build-uncached": {
"branch": "master",
"description": "A CI friendly wrapper around nix-build.",
"homepage": "",
"owner": "Mic92",
"repo": "nix-build-uncached",
"rev": "77fe5c8c4c5c7a1fa3f9baa042474b98f2456652",
"sha256": "04hqiw3rhz01qqyz2x1q14aml1ifk3m97pldf4v5vhd5hg73k1zn",
"type": "tarball",
"url": "https://github.com/Mic92/nix-build-uncached/archive/77fe5c8c4c5c7a1fa3f9baa042474b98f2456652.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-unstable",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",

View file

@ -232,7 +232,8 @@ lib.composeManyExtensions [
++ lib.optional (!self.isPyPy) pyBuildPackages.cffi
++ lib.optional (lib.versionAtLeast old.version "3.5")
(with pkgs.rustPlatform; [ cargoSetupHook rust.cargo rust.rustc ]);
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.openssl ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.openssl ]
++ lib.optionals stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security pkgs.libiconv ];
propagatedBuildInputs = old.propagatedBuildInputs or [ ] ++ [ self.cffi ];
} // lib.optionalAttrs (lib.versionAtLeast old.version "3.4" && lib.versionOlder old.version "3.5") {
CRYPTOGRAPHY_DONT_BUILD_RUST = "1";
@ -802,6 +803,19 @@ lib.composeManyExtensions [
interactive = enableTk || enableGtk3 || enableQt;
passthru = {
config = {
directories = { basedirlist = "."; };
libs = {
system_freetype = true;
system_qhull = true;
} // lib.optionalAttrs stdenv.isDarwin {
# LTO not working in darwin stdenv, see Nixpkgs #19312
enable_lto = false;
};
};
};
inherit (pkgs) tk tcl wayland qhull;
inherit (pkgs.xorg) libX11;
inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;
@ -809,10 +823,24 @@ lib.composeManyExtensions [
{
XDG_RUNTIME_DIR = "/tmp";
buildInputs = (old.buildInputs or [ ])
++ lib.optional enableGhostscript pkgs.ghostscript
++ lib.optional stdenv.isDarwin [ Cocoa ]
++ [ self.certifi ];
buildInputs = old.buildInputs or [ ] ++ [
pkgs.which
] ++ lib.optional enableGhostscript [
pkgs.ghostscript
] ++ lib.optional stdenv.isDarwin [
Cocoa
];
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [
self.certifi
pkgs.libpng
pkgs.freetype
qhull
]
++ lib.optionals enableGtk3 [ pkgs.cairo self.pycairo pkgs.gtk3 pkgs.gobject-introspection self.pygobject3 ]
++ lib.optionals enableTk [ pkgs.tcl pkgs.tk self.tkinter pkgs.libX11 ]
++ lib.optionals enableQt [ self.pyqt5 ]
;
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
pkg-config
@ -821,25 +849,9 @@ lib.composeManyExtensions [
self.setuptools-scm-git-archive
];
passthru.config = {
directories = { basedirlist = "."; };
libs = {
system_freetype = true;
system_qhull = true;
} // lib.optionalAttrs stdenv.isDarwin {
# LTO not working in darwin stdenv, see Nixpkgs #19312
enable_lto = false;
};
};
passthru = old.passthru or { } // passthru;
MPLSETUPCFG = pkgs.writeText "mplsetup.cfg" ''
[libs]
system_freetype = True
system_qhull = True
'' + lib.optionalString stdenv.isDarwin ''
# LTO not working in darwin stdenv, see NixOS/nixpkgs/pull/19312
enable_lto = false
'';
MPLSETUPCFG = pkgs.writeText "mplsetup.cfg" (lib.generators.toINI { } passthru.config);
# Matplotlib tries to find Tcl/Tk by opening a Tk window and asking the
# corresponding interpreter object for its library paths. This fails if
@ -861,24 +873,11 @@ lib.composeManyExtensions [
'' +
# avoid matplotlib trying to download dependencies
''
cp $MPLSETUPCFG mplsetup.cfg
echo "[libs]
system_freetype=true
system_qhull=true" > mplsetup.cfg
'';
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [
pkgs.libpng
pkgs.freetype
qhull
]
++ lib.optionals enableGtk3 [ pkgs.cairo self.pycairo pkgs.gtk3 pkgs.gobject-introspection self.pygobject3 ]
++ lib.optionals enableTk [ pkgs.tcl pkgs.tk self.tkinter pkgs.libX11 ]
++ lib.optionals enableQt [ self.pyqt5 ]
;
preBuild = ''
cp -r ${pkgs.qhull} .
'';
inherit (super.matplotlib) patches;
}
);

View file

@ -7,6 +7,10 @@ let
};
tools = pkgs.callPackage ./tools { };
nix-build-uncached = import sources.nix-build-uncached {
inherit pkgs;
};
in
pkgs.mkShell {
@ -23,5 +27,6 @@ pkgs.mkShell {
pkgs.jq
pkgs.nix-prefetch-git
pkgs.nix-eval-jobs
nix-build-uncached
];
}