Files
static-site-pipeline/hugo/content/posts/2024-11-28-net9-aot.md
2024-11-28 20:17:56 +00:00

29 lines
913 B
Markdown

---
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
];
}
}
}
```