Add post about .NET 9 and nixpkgs (#25)

This commit is contained in:
Patrick Stevens
2024-11-28 20:17:56 +00:00
committed by GitHub
parent 0408056c13
commit 1475932c43

View File

@@ -0,0 +1,28 @@
---
lastmod: "2024-11-28T20:10:00.0000000+00:00"
author: patrick
categories:
- philosophy
date: "2024-11-28T20:10:00.0000000+00:00"
title: NativeAOT in .NET 9 and Nixpkgs/darwin
summary: "How to get a NativeAOT build using nixpkgs"
---
When nixpkgs was at commit [af51545ec9a44eadf3fe3547610a5cdd882bc34e](https://github.com/NixOS/nixpkgs/tree/af51545ec9a44eadf3fe3547610a5cdd882bc34e), the following sufficed for `dotnet publish --self-contained --configuration Release` to Just Work to build a `<PublishAot>true</PublishAot>` executable on aarch64-darwin:
```nix
{
outputs = { nixpkgs, ... }:
let pkgs = nixpkgs.legacyPackages.aarch64-darwin; in
{
devShell = pkgs.mkShell {
buildInputs = [ pkgs.dotnetCorePackages.sdk_9_0 ];
packages = [
pkgs.clang
pkgs.darwin.ICU
pkgs.darwin.binutils
];
}
}
}
```