Skip to content

Commit

Permalink
Nix expr: Document nix-shell for dev and Kate
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Jul 5, 2024
1 parent 43c6e04 commit dbc6acc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
27 changes: 26 additions & 1 deletion Dist/nix_expr_usage_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ There are a few parameters you can tweak without writing a full Nix expression:
- `--argstr buildConfig Debug` builds the BizHawk solution in Debug configuration.
- `--argstr extraDefines "CoolFeatureFlag"` adds to `<DefineConstants/>`.
- `--arg initConfig {}` can be used to set up keybinds and such, though you probably won't want to use `--arg` for that.
- Check the source for the full list.
- Check [the source](default.nix) for the full list.

Every installable can also be used with `nix-shell`. Omitting `-A` is the same as `nix-shell -A emuhawk-latest`.
<!-- TODO haven't implemented LSPs
Expand Down Expand Up @@ -86,3 +86,28 @@ emuhawk-monort-local # = `cd output && mono EmuHawk.exe`
# if deps (besides NuGet packages) have changed, may need to do this instead, but it will do a slow copy of the repo to the Nix store
nix-shell -A emuhawk
```

## IDE setup

### Kate

Syntax highlighting is built-in, and autocomplete, static analysis, and navigation are provided by OmniSharp (LSP).
Build/test configurations aren't set up.

```sh
nix-shell --arg useKate true
Dist/BuildDebug.sh # populate build cache
kate src/BizHawk.Common/VersionInfo.cs &
```

Some of our source files are long and our projects are large, so the LSP client can be slow at times.

The scroll position for the syntax highlighting can become desynced from that of the text, leading to syntax getting multiple and/or incorrect colours.

Kate is not a .NET IDE and doesn't understand the Solution/Project structure or any MSBuild metadata; it sees only C# source files, and shows every file in the Git repo.

### VS Code / Codium

Not yet implemented.

There is a `.vs` dir in the repo, but it's outdated.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ Dev builds and a few recent releases can be built with Nix, either by cloning th
See the [dedicated Nix usage readme](Dist/nix_expr_usage_docs.md) for what attributes are exposed.
If you use a non-NixOS distro with Nix installed, you just need to add one argument and your host graphics drivers will be picked up thanks to nixGL.

You can also quickly get a development setup, including the .NET SDK and an IDE, with the provided `shell.nix`. See the [Nix-specific docs](Dist/nix_expr_usage_docs.md#ide-setup) for details.

[to top](#bizhawk)

### Development builds
Expand Down
1 change: 1 addition & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ It's probably a good idea to get the .NET SDK, even if you're not working on a .
- Linux
- Install the .NET 8 SDK (package name is usually `dotnet-sdk-8.0`, see [full instructions](https://learn.microsoft.com/en-gb/dotnet/core/install/linux)).
- VS Community isn't available for Linux, but Rider and VS Code are.
- Nix/NixOS users can get the .NET SDK ephemerally with the provided `shell.nix`. For IDE setup and more, see the [Nix-specific docs](Dist/nix_expr_usage_docs.md#ide-setup).
- macOS
- Note that EmuHawk does not currently support macOS.
- Install the .NET 8 SDK [manually](https://learn.microsoft.com/en-gb/dotnet/core/install/macos) or with Homebrew.
Expand Down
1 change: 0 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
, useNanoAndCola ? false
, useVSCode ? false
}: let
# thinking of exposing pre-configured IDEs from `default.nix` so they're available here
avail = import ./. { inherit debugDotnetHostCrashes debugPInvokes forNixOS system; };
f = drv: mkShell {
packages = [ git powershell ]
Expand Down

0 comments on commit dbc6acc

Please sign in to comment.