https://github.com/ink-splatters/swift-shell
nix flakes based swift dev shell
https://github.com/ink-splatters/swift-shell
Last synced: 3 months ago
JSON representation
nix flakes based swift dev shell
- Host: GitHub
- URL: https://github.com/ink-splatters/swift-shell
- Owner: ink-splatters
- License: mit
- Created: 2024-01-21T21:38:36.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-31T15:42:26.000Z (5 months ago)
- Last Synced: 2025-01-14T05:31:08.792Z (5 months ago)
- Language: Nix
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nix development shell for Swift
Requires nix [flakes](https://nixos.wiki/wiki/Flakes) support.
## Usage
```shell
nix develop github:ink-splatters/swift-shell
```## Development
### direnv
It's recommended to install `direnv`:
```sh
nix profile install nixpkgs#direnv
```#### POSIX shell integration
```sh
shell_name=$(basename $SHELL)
[[ $shell_name == "bash" ]] && rc=~/.bashrc
[[ $shell_name == "zsh" ]] && rc=~/.zshrccat <<'EOF' >> $rc
# direnv shell integration
eval "$(direnv hook $SHELL)"
EOF
source $rc
```#### fish support
install the integration support via `fisher`:
```fish
fisher install halostatue/[email protected]
```then reload your shell configuration.
### Enter development environment
```sh
nix run .#install-hooks
direnv allow .
nix develop
```NOTE: any changes to `git-hooks` configuration must be followed by running `nix run .#install-hooks`
### SwiftPM
If you want to package your SwiftPM project with `nix`, you should use `swiftpm2nix`
for vendoring dependencies.See [Packaging with SwiftPM](https://nixos.org/manual/nixpkgs/stable/#ssec-swift-packaging-with-swiftpm)
### Availability of XCTest
`XCTest` uses Obj-C runtime which is not part of opensource swift and cannot be shiped with `nix`, therefore
it's recommended to use swift `Testing` instead.