Skip to content

Instantly share code, notes, and snippets.

@SergioRibera
Created March 2, 2024 07:54
Show Gist options
  • Save SergioRibera/f25888d2bf9c449db38b8e2b0916d2c1 to your computer and use it in GitHub Desktop.
Save SergioRibera/f25888d2bf9c449db38b8e2b0916d2c1 to your computer and use it in GitHub Desktop.
Dotnet flake for NixOs
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nuget-packageslock2nix = {
url = "github:mdarocha/nuget-packageslock2nix/main";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, nuget-packageslock2nix, ... }: {
packages.x86_64-linux.default =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
pkgs.buildDotnetModule {
pname = "dn_console";
version = "0.0.1";
src = ./.;
nugetDeps = nuget-packageslock2nix.lib {
system = "x86_64-linux";
name = "example";
lockfiles = [
./packages.lock.json
];
};
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
devShells.x86_64-linux.default = let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
pkgs.mkShell {
buildInputs = with pkgs; [
dotnet-sdk_8
];
DOTNET_ROOT = "${pkgs.dotnet-runtime_8}"; # Important to run binary
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment