From 4914173e34c8a3bd46669f4eaffdd6209a170e57 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 6 Aug 2026 19:56:05 -0400 Subject: [PATCH] swiftPackages_ng.swift-docc: init at 6.2.4 --- .../by-name/sw/swift-docc/package.nix | 66 +++++++++++++++++++ .../compilers/swift_ng/sources-6.2.json | 6 ++ 2 files changed, 72 insertions(+) create mode 100644 pkgs/development/compilers/swift_ng/by-name/sw/swift-docc/package.nix diff --git a/pkgs/development/compilers/swift_ng/by-name/sw/swift-docc/package.nix b/pkgs/development/compilers/swift_ng/by-name/sw/swift-docc/package.nix new file mode 100644 index 000000000000..d2adb46a9e1f --- /dev/null +++ b/pkgs/development/compilers/swift_ng/by-name/sw/swift-docc/package.nix @@ -0,0 +1,66 @@ +{ + lib, + fetchFromGitHub, + fetchSwiftPMDeps, + stdenv, + swift, + swift-docc-render, + swiftpm, + swift_release, + swift_sources, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "swift-docc"; + version = swift_release; + + src = fetchFromGitHub { + owner = "swiftlang"; + repo = "swift-docc"; + tag = "swift-${finalAttrs.version}-RELEASE"; + inherit (swift_sources.swift-docc) hash; + }; + + postPatch = + # SignalTests.testTrappingSignal tries to access `/bin/bash`. Replace it with the shell in the stdenv. + '' + substituteInPlace Tests/SwiftDocCUtilitiesTests/SignalTests.swift \ + --replace-fail '/bin/bash' ${lib.escapeShellArg stdenv.shell} + ''; + + strictDeps = true; + + swiftpmDeps = fetchSwiftPMDeps { + inherit (finalAttrs) pname version src; + inherit (swift_sources.swift-docc.swiftpmDeps) hash; + }; + + swiftpmFlags = [ + # Otherwise fails to build with `error: module 'SwiftDocC' was not compiled for testing`. + "-Xswiftc" + "-enable-testing" + ]; + + nativeBuildInputs = [ + swift + swiftpm + ]; + + doCheck = !stdenv.hostPlatform.isDarwin; + + postInstall = '' + mkdir -p "$out/share/docc" + ln -s "${swift-docc-render}/dist" "$out/share/docc/render" + ''; + + __structuredAttrs = true; + + meta = { + description = "Documentation compiler for Swift"; + mainProgram = "docc"; + homepage = "https://github.com/swiftlang/swift-docc"; + platforms = lib.platforms.darwin ++ lib.platforms.linux; + license = lib.licenses.asl20; + teams = [ lib.teams.swift ]; + }; +}) diff --git a/pkgs/development/compilers/swift_ng/sources-6.2.json b/pkgs/development/compilers/swift_ng/sources-6.2.json index 0e1af3664e57..9d1d2acb6835 100644 --- a/pkgs/development/compilers/swift_ng/sources-6.2.json +++ b/pkgs/development/compilers/swift_ng/sources-6.2.json @@ -23,6 +23,12 @@ "swift-corelibs-xctest": { "hash": "sha256-BbzY1kZUaHu7O29c8J7xDuelik6lhqmfSSskvvPZ7R4=" }, + "swift-docc": { + "hash": "sha256-zu70RyYvnfhW3DdovSeLFXTNmdHrhdnSYCN8RisSkt8=", + "swiftpmDeps": { + "hash": "sha256-kJFuNw/pRn2A4UMvGcX3j04Faz44mriSz90u8hLdaZc=" + } + }, "swift-docc-render": { "hash": "sha256-uikFKvbjdU2BW3G0hCLah5Dt86DfAJ0etirX2nYVD+8=", "npmDeps": {