Skip to content

Commit

Permalink
swift-docc: init at 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
stephank committed Oct 10, 2022
1 parent ce2dd8b commit d63aef6
Show file tree
Hide file tree
Showing 5 changed files with 380 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkgs/development/compilers/swift/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ let
inherit (apple_sdk.frameworks) CryptoKit LocalAuthentication;
};

swift-docc = callPackage ./swift-docc {
inherit (apple_sdk.frameworks) CryptoKit LocalAuthentication;
};

};

in self
60 changes: 60 additions & 0 deletions pkgs/development/compilers/swift/swift-docc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{ 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 ];
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"object": {
"pins": [
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "d2930e8fcf9c33162b9fcc1d522bc975e2d4179b",
"version": "1.0.1"
}
},
{
"package": "cmark-gfm",
"repositoryURL": "https://github.com/apple/swift-cmark.git",
"state": {
"branch": "release/5.7-gfm",
"revision": "792c1c3326327515ce9bf64c44196b7f4daab9a6",
"version": null
}
},
{
"package": "swift-crypto",
"repositoryURL": "https://github.com/apple/swift-crypto.git",
"state": {
"branch": null,
"revision": "9680b7251cd2be22caaed8f1468bd9e8915a62fb",
"version": "1.1.2"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6",
"version": "1.0.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": "release/5.7",
"revision": "8682202025906dce29a8b04f9263f40ba87b89d8",
"version": null
}
},
{
"package": "CLMDB",
"repositoryURL": "https://github.com/apple/swift-lmdb.git",
"state": {
"branch": "release/5.7",
"revision": "6ea45a7ebf6d8f72bd299dfcc3299e284bbb92ee",
"version": null
}
},
{
"package": "swift-markdown",
"repositoryURL": "https://github.com/apple/swift-markdown.git",
"state": {
"branch": "release/5.7",
"revision": "d6cd065a7e4b6c3fad615dcd39890e095a2f63a2",
"version": null
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "1d425b0851ffa2695d488cce1d68df2539f42500",
"version": "2.31.2"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "2e74773972bd6254c41ceeda827f229bccbf1c0f",
"version": "2.15.0"
}
}
]
},
"version": 1
}
67 changes: 67 additions & 0 deletions pkgs/development/compilers/swift/swift-docc/generated/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This file was generated by swiftpm2nix.
{ lib, fetchgit }: rec {
sources = {
"swift-argument-parser" = fetchgit {
url = "https://github.com/apple/swift-argument-parser";
rev = "d2930e8fcf9c33162b9fcc1d522bc975e2d4179b";
sha256 = "070gip241dgn3d0nxgwxva4vp6kbnf11g01q5yaq6kmflcmz58f2";
};
"swift-cmark" = fetchgit {
url = "https://github.com/apple/swift-cmark.git";
rev = "792c1c3326327515ce9bf64c44196b7f4daab9a6";
sha256 = "0xfchdgls3070z16in8ks69y8fpiajmyk7lmp5h7ym7164isa6bb";
};
"swift-crypto" = fetchgit {
url = "https://github.com/apple/swift-crypto.git";
rev = "9680b7251cd2be22caaed8f1468bd9e8915a62fb";
sha256 = "0h054rq14jyg94aiymmp37vqz60a13dlczp5g09pln724j4ypv92";
};
"swift-docc-plugin" = fetchgit {
url = "https://github.com/apple/swift-docc-plugin";
rev = "3303b164430d9a7055ba484c8ead67a52f7b74f6";
sha256 = "11d6nhi139yzk1lxxrixsbgyj1bnvmh40wj30y725q83nqq49ljh";
};
"swift-docc-symbolkit" = fetchgit {
url = "https://github.com/apple/swift-docc-symbolkit";
rev = "8682202025906dce29a8b04f9263f40ba87b89d8";
sha256 = "14hb2wc09hisf2r2yny17z28z0m58cf4lnqaczad2x2hk4s1iayi";
};
"swift-lmdb" = fetchgit {
url = "https://github.com/apple/swift-lmdb.git";
rev = "6ea45a7ebf6d8f72bd299dfcc3299e284bbb92ee";
sha256 = "1m5y6x2vs1wflcv2c57rx87gh12sy0hkwy5iy9inxmda2mcs8qcb";
};
"swift-markdown" = fetchgit {
url = "https://github.com/apple/swift-markdown.git";
rev = "d6cd065a7e4b6c3fad615dcd39890e095a2f63a2";
sha256 = "09270bfrwlp904cma29hsbhr1p25v8kwgvhcfi7lg2av7aaknd97";
};
"swift-nio" = fetchgit {
url = "https://github.com/apple/swift-nio.git";
rev = "1d425b0851ffa2695d488cce1d68df2539f42500";
sha256 = "04bvay94b34ynmlvgyl9a7f431l3cf8k2zr483spv8mvyh1hxiqn";
};
"swift-nio-ssl" = fetchgit {
url = "https://github.com/apple/swift-nio-ssl.git";
rev = "2e74773972bd6254c41ceeda827f229bccbf1c0f";
sha256 = "1ak4aldilmz0pnfgbwq1x4alr38nfyvx2pz7p2vi2plf82da80g5";
};
};
configure = ''
mkdir -p .build/checkouts
ln -sf ${./Package.resolved} ./Package.resolved
install -m 0600 ${./workspace-state.json} ./.build/workspace-state.json
''
+ lib.concatStrings (lib.mapAttrsToList (name: src: ''
ln -s '${src}' '.build/checkouts/${name}'
'') sources)
+ ''
# Helper that makes a swiftpm dependency mutable by copying the source.
swiftpmMakeMutable() {
local orig="$(readlink .build/checkouts/$1)"
rm .build/checkouts/$1
cp -r "$orig" .build/checkouts/$1
chmod -R u+w .build/checkouts/$1
}
'';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"object": {
"artifacts": [],
"dependencies": [
{
"basedOn": null,
"packageRef": {
"identity": "swift-argument-parser",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-argument-parser",
"name": "swift-argument-parser"
},
"state": {
"checkoutState": {
"revision": "d2930e8fcf9c33162b9fcc1d522bc975e2d4179b",
"version": "1.0.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-cmark",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-cmark.git",
"name": "cmark-gfm"
},
"state": {
"checkoutState": {
"branch": "release/5.7-gfm",
"revision": "792c1c3326327515ce9bf64c44196b7f4daab9a6"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-cmark"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-crypto",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-crypto.git",
"name": "swift-crypto"
},
"state": {
"checkoutState": {
"revision": "9680b7251cd2be22caaed8f1468bd9e8915a62fb",
"version": "1.1.2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-crypto"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-docc-plugin",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-docc-plugin",
"name": "SwiftDocCPlugin"
},
"state": {
"checkoutState": {
"revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6",
"version": "1.0.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-docc-plugin"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-docc-symbolkit",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-docc-symbolkit",
"name": "SymbolKit"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "8682202025906dce29a8b04f9263f40ba87b89d8"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-docc-symbolkit"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-lmdb",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-lmdb.git",
"name": "CLMDB"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "6ea45a7ebf6d8f72bd299dfcc3299e284bbb92ee"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-lmdb"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-markdown",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-markdown.git",
"name": "swift-markdown"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "d6cd065a7e4b6c3fad615dcd39890e095a2f63a2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-markdown"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-nio",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-nio.git",
"name": "swift-nio"
},
"state": {
"checkoutState": {
"revision": "1d425b0851ffa2695d488cce1d68df2539f42500",
"version": "2.31.2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-nio"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-nio-ssl",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-nio-ssl.git",
"name": "swift-nio-ssl"
},
"state": {
"checkoutState": {
"revision": "2e74773972bd6254c41ceeda827f229bccbf1c0f",
"version": "2.15.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-nio-ssl"
}
]
},
"version": 5
}

0 comments on commit d63aef6

Please sign in to comment.