Skip to content

Commit

Permalink
feat(nix): set up dotnet lsp and formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Dec 23, 2024
1 parent f99e0ed commit e47cba3
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.30.3",
"commands": [
"dotnet-csharpier"
],
"rollForward": false
}
}
}
5 changes: 5 additions & 0 deletions .csharpierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.direnv/
target/
**/[Bb]in/
**/[Oo]bj/
.git/
4 changes: 3 additions & 1 deletion .github/workflows/csharp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install dotnet tools
run: dotnet tool restore
- name: Check formatting
run: dotnet format --verify-no-changes
run: dotnet csharpier --check .

test:
name: Run Tests
Expand Down
5 changes: 1 addition & 4 deletions did-csharp/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@

namespace did_csharp
{
public class Class1
{

}
public class Class1 { }
}
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
];
config = {
# allowUnfree = true;
permittedInsecurePackages = [
# Needed for roslyn-ls, see
# https://github.com/NixOS/nixpkgs/blob/4989a246/pkgs/by-name/ro/roslyn-ls/package.nix#L21
"dotnet-sdk-6.0.428"
];
};
};
});
Expand Down
9 changes: 8 additions & 1 deletion nix/devShells.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ let
rustPlatform = pkgs.makeRustPlatform {
inherit (rustToolchain) cargo rustc;
};
dotnet = (with pkgs.dotnetCorePackages;
# We will combine the two latest dotnet SDKs to give all tools time to
# upgrade
combinePackages [
sdk_9_0
]);
in
{
default = pkgs.mkShell {
# These programs be available to the dev shell
buildInputs = (with pkgs; [
cargo-deny
dotnetCorePackages.sdk_9_0
dotnet
mdbook
mdbook-mermaid
nixpkgs-fmt
roslyn-ls
]) ++ pkgs.lib.optional pkgs.stdenv.isDarwin [
pkgs.libiconv
] ++ [
Expand Down
5 changes: 1 addition & 4 deletions nix/inputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ let
isDarwin = (system == "aarch64-darwin" || system == "x86_64-darwin");
in
{
inherit (inputs-raw) fenix nixos-generators home-manager deploy-rs;
self = inputs-raw.self;
nixpkgs = if isDarwin then inputs-raw.nixpkgs-24_11-darwin else inputs-raw.nixos-24_11;
nixpkgs-unstable = if isDarwin then inputs-raw.nixpkgs-unstable else inputs-raw.nixos-unstable;
# fenix = if isDarwin then inputs-raw.fenix-darwin else inputs-raw.fenix-linux;
fenix = inputs-raw.fenix;
nixos-generators = inputs-raw.nixos-generators;
home-manager = inputs-raw.home-manager;
deploy-rs = inputs-raw.deploy-rs;
}

0 comments on commit e47cba3

Please sign in to comment.