aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 1ef2fb6617319182b4540fb29209367635e5b3f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };
  outputs = { self, flake-utils, nixpkgs }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system};
      in {
        packages = {
          # Build the backend using 'nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#server'
          server = pkgs.buildDotnetModule rec {
            pname = "VPNAuth.Server";
            version = "0.0.1";
            src = ./.;
            projectFile = "VPNAuth.Server/VPNAuth.Server.csproj";
            dotnet-sdk = pkgs.dotnetCorePackages.sdk_9_0;
            dotnet-runtime = pkgs.dotnetCorePackages.dotnet_9.aspnetcore;
            
            # To create or update the deps.nix file run the following steps from the project root:
            #  1. Create a nix-shell using 'nix-shell -p nuget-to-nix dotnetCorePackages.sdk_9_0'
            #  2. Run 'rm -rf out/' inside the nix-shell
            #  3. Run 'dotnet restore VPNAuth.Server --packages out' inside the nix-shell
            #  4. Run 'nuget-to-nix out > deps.nix' inside the nix-shell
            nugetDeps = ./deps.nix;
          };
        };
    });
}