mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-17 15:40:12 +03:00
61 lines
1.7 KiB
Nix
61 lines
1.7 KiB
Nix
![]() |
{ lib
|
||
|
, stdenv
|
||
|
, callPackage
|
||
|
, fetchFromGitHub
|
||
|
, swift
|
||
|
, swiftpm
|
||
|
, Foundation
|
||
|
, XCTest
|
||
|
, CryptoKit
|
||
|
, LocalAuthentication
|
||
|
}:
|
||
|
let
|
||
|
# Generated by swiftpm2nix.
|
||
|
generated = callPackage ./generated { };
|
||
|
in
|
||
|
stdenv.mkDerivation rec {
|
||
|
pname = "swift-docc";
|
||
|
|
||
|
# Releases are made as part of the Swift toolchain, so versions should match.
|
||
|
version = "5.7";
|
||
|
src = fetchFromGitHub {
|
||
|
owner = "apple";
|
||
|
repo = "swift-docc";
|
||
|
rev = "swift-${version}-RELEASE";
|
||
|
hash = "sha256-WlXJMAnrlVPCM+iCIhG0Gyho76BsC2yVBEpX3m/WiIQ=";
|
||
|
};
|
||
|
# TODO: We could build this from `apple/swift-docc-render` source, but that
|
||
|
# repository is not tagged.
|
||
|
render-artifact = fetchFromGitHub {
|
||
|
owner = "apple";
|
||
|
repo = "swift-docc-render-artifact";
|
||
|
rev = "swift-${version}-RELEASE";
|
||
|
hash = "sha256-ttdurN/K7OX+I4577jG3YGeRs+GLUTc7BiiEZGmFD+s=";
|
||
|
};
|
||
|
|
||
|
nativeBuildInputs = [ swift swiftpm ];
|
||
|
buildInputs = [ Foundation XCTest ]
|
||
|
++ lib.optionals stdenv.isDarwin [ CryptoKit LocalAuthentication ];
|
||
|
|
||
|
configurePhase = generated.configure;
|
||
|
|
||
|
# TODO: Tests depend on indexstore-db being provided by an existing Swift
|
||
|
# toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc.
|
||
|
#doCheck = true;
|
||
|
|
||
|
installPhase = ''
|
||
|
binPath="$(swiftpmBinPath)"
|
||
|
mkdir -p $out/bin $out/share/docc
|
||
|
cp $binPath/docc $out/bin/
|
||
|
ln -s ${render-artifact}/dist $out/share/docc/render
|
||
|
'';
|
||
|
|
||
|
meta = {
|
||
|
description = "Documentation compiler for Swift";
|
||
|
homepage = "https://github.com/apple/swift-docc";
|
||
|
platforms = with lib.platforms; linux ++ darwin;
|
||
|
license = lib.licenses.asl20;
|
||
|
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
|
||
|
};
|
||
|
}
|