Skip to content

Commit

Permalink
fix macos build
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Feb 7, 2024
1 parent 117739f commit 9e9a319
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ dump.txt
*.playground/
tester/
.swiftpm/
result/
result

.direnv
.envrc
41 changes: 22 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,19 @@

ndeps = pkgs:
with pkgs; [
swift
swiftPackages.swift
swiftPackages.swiftpm

pkg-config
];

bdeps = pkgs:
with pkgs;
[
swiftPackages.swift-driver
swiftPackages.stdenv
swiftPackages.XCTest

# git
# cacert
#
# clang
# coreutils
swiftPackages.Foundation
swiftPackages.Dispatch

# SwiftExif
libexif
Expand All @@ -44,7 +40,7 @@
expat.dev
fftw.dev
fribidi
glib
glib.dev
lcms2.dev
libdatrie.dev
libgsf.dev
Expand All @@ -59,17 +55,26 @@
pango.dev
pcre2.dev
vips.dev

# Added 2024-02-07
libarchive.dev
cgif
libspng.dev
xorg.libXdmcp.dev
libhwy

# If the compilation of swift-vips is failing with something like:
# fatal error: 'glib.h' file not found
# look for a warning before the error like:
# warning: couldn't find pc file for spng
# and find that library in Nix and add it to the buildDeps.
]
# swift-vips linux deps
++ lib.optionals pkgs.stdenv.isLinux [
swiftPackages.Foundation
swift-corelibs-libdispatch

# swift-vips deps
libselinux.dev
libsepol.dev
pcre.dev
util-linux.dev
xorg.libXdmcp.dev
];
in
{
Expand All @@ -88,22 +93,20 @@
]))
./.;
in
pkgs.stdenv.mkDerivation rec {
pkgs.swiftPackages.stdenv.mkDerivation rec {
pname = "munin";
version = "0.0.0";

inherit src;

strictDeps = true;

# Including SwiftPM as a nativeBuildInput provides a buildPhase for you.
# This by default performs a release build using SwiftPM, essentially:
# swift build -c release
nativeBuildInputs = ndeps pkgs;
buildInputs = bdeps pkgs;

propagatedBuildInputs = with pkgs; [
glib
];

# The helper provides a configure snippet that will prepare all dependencies
# in the correct place, where SwiftPM expects them.
configurePhase = generated.configure;
Expand Down

0 comments on commit 9e9a319

Please sign in to comment.