From d3aea80306a2a253cc74c59315476a5f3a1377e4 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sat, 20 Jul 2024 12:22:56 -0700 Subject: [PATCH] Add Swift environment --- README.md | 10 +++++++++- flake.nix | 5 +++++ swift/.envrc | 1 + swift/flake.lock | 25 +++++++++++++++++++++++++ swift/flake.nix | 23 +++++++++++++++++++++++ 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 swift/.envrc create mode 100644 swift/flake.lock create mode 100644 swift/flake.nix diff --git a/README.md b/README.md index 305f0ae..fd48d37 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Once your preferred template has been initialized, you can use the provided shel | [Rust] | [`rust`](./rust/) | | [Scala] | [`scala`](./scala/) | | [Shell] | [`shell`](./shell/) | +| [Swift] | [`swift`](./swift) | | [Vlang] | [`vlang`](./vlang/) | | [Zig] | [`zig`](./zig/) | @@ -281,7 +282,12 @@ A dev template that's fully customizable. - [shellcheck] 0.9.0 -### [`Vlang`](./vlang/) +### [`swift`](./swift/) + +- [Swift] 5.8 +- [sourcekit-lsp] + +### [`vlang`](./vlang/) - [Vlang] 0.4.4 @@ -401,7 +407,9 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [shellcheck]: https://www.shellcheck.net/ [statix]: https://github.com/nerdypepper/statix [sbt]: https://www.scala-sbt.org +[sourcekit-lsp]: https://github.com/swiftlang/sourcekit-lsp [spago]: https://github.com/purescript/spago +[swift]: https://www.swift.org [tectonic]: https://tectonic-typesetting.github.io/ [terraform]: https://terraform.io [terragrunt]: https://terragrunt.gruntwork.io diff --git a/flake.nix b/flake.nix index 6c1fd89..57e15e8 100644 --- a/flake.nix +++ b/flake.nix @@ -261,6 +261,11 @@ description = "Shell script development environment"; }; + swift = { + path = ./swift; + description = "Swift development environment"; + }; + vlang = { path = ./vlang; description = "Vlang developent environment"; diff --git a/swift/.envrc b/swift/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/swift/.envrc @@ -0,0 +1 @@ +use flake diff --git a/swift/flake.lock b/swift/flake.lock new file mode 100644 index 0000000..86ed220 --- /dev/null +++ b/swift/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1721379653, + "narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=", + "rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374", + "revCount": 655136, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.655136%2Brev-1d9c2c9b3e71b9ee663d11c5d298727dace8d374/0190cd4f-c0eb-72cb-834b-ac854aa282dc/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/swift/flake.nix b/swift/flake.nix new file mode 100644 index 0000000..8962899 --- /dev/null +++ b/swift/flake.nix @@ -0,0 +1,23 @@ +{ + description = "A Nix-flake-based Swift development environment"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + swift + sourcekit-lsp + ]; + }; + }); + }; +}