File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,53 @@ Alternatively, you can install the tool on macOS or Linux by using [Mint](https:
9696$ mint install nicklockwood/SwiftFormat
9797```
9898
99+ If you use Nix, you can add SwiftFormat to a ` devShell ` using ` nixpkgs ` :
100+
101+ ``` nix
102+ {
103+ inputs = {
104+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
105+ };
106+
107+ outputs = { nixpkgs, ... }:
108+ let
109+ system = "aarch64-darwin";
110+ pkgs = import nixpkgs { inherit system; };
111+ in {
112+ devShells.${system}.default = pkgs.mkShell {
113+ packages = [
114+ pkgs.swiftformat
115+ ];
116+ };
117+ };
118+ }
119+ ```
120+
121+ If you need to pin SwiftFormat to a specific version in your ` devShell ` , you can use [ ` acevif/swiftformat-nix ` ] ( https://github.com/acevif/swiftformat-nix ) :
122+
123+ ``` nix
124+ {
125+ inputs = {
126+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
127+ swiftformat-nix.url = "github:acevif/swiftformat-nix";
128+ };
129+
130+ outputs = { nixpkgs, swiftformat-nix, ... }:
131+ let
132+ system = "aarch64-darwin";
133+ pkgs = import nixpkgs { inherit system; };
134+ in {
135+ devShells.${system}.default = pkgs.mkShell {
136+ packages = [
137+ swiftformat-nix.packages.${system}.swiftformat_0_58_7
138+ ];
139+ };
140+ };
141+ }
142+ ```
143+
144+ Replace ` aarch64-darwin ` with your system, and replace ` swiftformat_0_58_7 ` with the version you want to install.
145+
99146Or if you prefer, you can check out and build SwiftFormat manually on macOS, Linux or Windows as follows:
100147
101148``` bash
You can’t perform that action at this time.
0 commit comments