Skip to content

Instantly share code, notes, and snippets.

@niklaskorz
Created August 1, 2025 08:48
Show Gist options
  • Save niklaskorz/ac529292db450151ff75ab8cdef49c2a to your computer and use it in GitHub Desktop.
Save niklaskorz/ac529292db450151ff75ab8cdef49c2a to your computer and use it in GitHub Desktop.
Swift 6 binary package
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
ncurses,
zlib,
libgcc,
libuuid,
libxml2,
libedit,
curl,
sqlite,
python311,
}:
let
# Replace with libxml2_13 once staging lands
libxml2' = libxml2.overrideAttrs rec {
version = "2.13.8";
src = fetchurl {
url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor version}/libxml2-${version}.tar.xz";
hash = "sha256-J3KUyzMRmrcbK8gfL0Rem8lDW4k60VuyzSsOhZoO6Eo=";
};
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "swift";
version = "6.1.2";
src = fetchurl {
url = "https://download.swift.org/swift-${finalAttrs.version}-release/debian12/swift-${finalAttrs.version}-RELEASE/swift-${finalAttrs.version}-RELEASE-debian12.tar.gz";
hash = "sha256-MTCYuzmEZ/MzF63caYzU8mD8rnkWw2koBfoyFI90XmI=";
};
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
ncurses
zlib
libgcc.lib
libuuid
libxml2'
curl
sqlite
python311
];
installPhase = ''
runHook preInstall
mv usr $out
ln -s ${libedit}/lib/libedit.so $out/lib/libedit.so.2
runHook postInstall
'';
meta = {
mainProgram = "swift";
description = "Swift Programming Language";
homepage = "https://www.swift.org/";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.asl20;
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers; [ niklaskorz ];
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment