Ada: Difference between revisions

imported>Blitz
Add a link to an Ada example.
m categorize
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Ada / Gnat Support =
[https://ada-lang.io/ Ada] is a programming language.


The GNAT Ada toolchain is fully packaged in NixOS and can be used to build software. It has a bit less convenience than typical C/C++ toolchains due to its small user base. A simple Ada program using GPR can be built as follows:
== Building programs ==
=== GNAT ===


<syntaxHighlight lang=nix>
The GNAT Ada toolchain is fully packaged in [[Nixpkgs]] and can be used to build software. It has a bit less convenience than typical [[C]]/[[C++]] toolchains due to its small user base. A simple Ada program using GPR can be built as follows:
 
<syntaxHighlight lang="nix">
{ stdenv, gnat, gprbuild, glibc }:
{ stdenv, gnat, gprbuild, glibc }:


Line 43: Line 46:
</syntaxHighlight>
</syntaxHighlight>


== Building Static Binaries ==
==== Building static binaries ====


If you try to build static binaries, you need to add the static version of libc manually. For this add <syntaxHighlight lang=nix>glibc</syntaxHighlight> to the derivation parameters (at the top) and add the following to the derivation itself.
If you try to build static binaries, you need to add the static version of libc manually. For this, add <code>glibc</code> to the derivation parameters (at the top) and add the following to the derivation itself.


<syntaxHighlight lang=nix>
<syntaxHighlight lang="nix">
   buildInputs = [
   buildInputs = [
     glibc.static
     glibc.static
Line 53: Line 56:
</syntaxHighlight>
</syntaxHighlight>


There is an example on [https://github.com/blitz/adahello Github].
There is an example on [https://github.com/blitz/adahello GitHub].
 
[[Category:Languages]]