diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..9cff1bf --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "csharpier": { + "version": "0.30.3", + "commands": [ + "dotnet-csharpier" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/.csharpierignore b/.csharpierignore new file mode 100644 index 0000000..d899011 --- /dev/null +++ b/.csharpierignore @@ -0,0 +1,5 @@ +.direnv/ +target/ +**/[Bb]in/ +**/[Oo]bj/ +.git/ diff --git a/.github/workflows/csharp.yaml b/.github/workflows/csharp.yaml index 4f506f6..10678d8 100644 --- a/.github/workflows/csharp.yaml +++ b/.github/workflows/csharp.yaml @@ -13,8 +13,10 @@ jobs: steps: - uses: actions/checkout@v4.2.0 + - 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 diff --git a/did-csharp/Class1.cs b/did-csharp/Class1.cs index 205a6cb..6d15690 100644 --- a/did-csharp/Class1.cs +++ b/did-csharp/Class1.cs @@ -2,8 +2,5 @@ namespace did_csharp { - public class Class1 - { - - } + public class Class1 { } } diff --git a/flake.nix b/flake.nix index b901f70..da56f1f 100644 --- a/flake.nix +++ b/flake.nix @@ -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" + ]; }; }; }); diff --git a/nix/devShells.nix b/nix/devShells.nix index d64a4c7..c0fed45 100644 --- a/nix/devShells.nix +++ b/nix/devShells.nix @@ -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 ] ++ [ diff --git a/nix/inputs.nix b/nix/inputs.nix index ff2556d..8b2317e 100644 --- a/nix/inputs.nix +++ b/nix/inputs.nix @@ -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; }