Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,53 @@ Alternatively, you can install the tool on macOS or Linux by using [Mint](https:
$ mint install nicklockwood/SwiftFormat
```

If you use Nix, you can add SwiftFormat to a `devShell` using `nixpkgs`:

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = { nixpkgs, ... }:
let
system = "aarch64-darwin";
pkgs = import nixpkgs { inherit system; };
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
pkgs.swiftformat
];
};
};
}
```

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):

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
swiftformat-nix.url = "github:acevif/swiftformat-nix";
};

outputs = { nixpkgs, swiftformat-nix, ... }:
let
system = "aarch64-darwin";
pkgs = import nixpkgs { inherit system; };
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
swiftformat-nix.packages.${system}.swiftformat_0_58_7
];
};
};
}
```

Replace `aarch64-darwin` with your system, and replace `swiftformat_0_58_7` with the version you want to install.

Or if you prefer, you can check out and build SwiftFormat manually on macOS, Linux or Windows as follows:

```bash
Expand Down
Loading