Hello everyone,
for a project, I have to develop with csharp, dotnet, and a library called Monogame on my NixOS machine.
For my development environment I am using a flake that looks something like this
{
description = "dotnet flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
dotnetCorePackages.dotnet_8.sdk
];
};
};
}
As intended the nix develop
provides me with the dotnet
command, and compiling the project with dotnet build
returns with no errors.
But running dotnet run
results in the following stack trace.
Unhandled exception. Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device!
---> System.NullReferenceException: Object reference not set to an instance of an object.
at MonoGame.OpenGL.GL.LoadExtensions()
at MonoGame.OpenGL.GraphicsContext..ctor(IWindowInfo info)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformSetup()
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Setup()
at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, Boolean preferHalfPixelOffset, PresentationParameters presentationParameters)
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation gdi)
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()
at Microsoft.Xna.Framework.Game.DoInitialize()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Program.<Main>$(String[] args) in /path/to/project/Program.cs:line 2
Does anyone have an idea why this error could occur?
I am using NixOS with the i3 window manager.
Thanks for any help.