I configure my VSCode using home-manager and development environments using flakes and direnv.
I wanted to try out Swift last week, but it didn’t work.
I installed the extension using this expression:
pkgs.vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "swift-lang";
publisher = "sswg";
version = "1.10.0";
sha256 = "sha256-RrGf+/w9zEE+pc9Pokfn/lOjcaFYfoQnUkg/BQCh7TI=";
};
}
And I wrote an environment with this flake:
{
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.clangStdenv.mkDerivation {
name = "env";
buildInputs = with pkgs; [
swift
swiftpm
];
};
}
);
}
Unfortunately, running swift package resolve
(which the language server seems to do) results in this error:
error: 'swift-test': Invalid manifest (compiled with: ["/nix/store/xiqdlmqh19s71brh818z13f41cfx149r-swift-wrapper-5.8/bin/swiftc", "-vfsoverlay", "/tmp/nix-shell.RqhYRg/TemporaryDirectory.F9Lxwo/vfs.yaml", "-L", "/nix/store/p4639kdk7qlz8plfnlgka50fiicx5r9b-swiftpm-5.8/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/nix/store/p4639kdk7qlz8plfnlgka50fiicx5r9b-swiftpm-5.8/lib/swift/pm/ManifestAPI", "-swift-version", "5", "-I", "/nix/store/p4639kdk7qlz8plfnlgka50fiicx5r9b-swiftpm-5.8/lib/swift/pm/ManifestAPI", "-package-description-version", "5.8.0", "/home/anselmschueler/Documents/git/localhost/swift-test/Package.swift", "-o", "/tmp/nix-shell.RqhYRg/TemporaryDirectory.BYsuHR/swift-test-manifest"])
/tmp/nix-shell.RqhYRg/TemporaryDirectory.BYsuHR/swift-test-manifest: error while loading shared libraries: libdispatch.so: cannot open shared object file: No such file or directory
I tried adding swift-corelibs-libdispatch
to the inputs, to no avail.
Does anybody know what needs to be done?