Julia: Difference between revisions

Klinger (talk | contribs)
Added an example using the withPackages function
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[https://docs.julialang.org/en/v1.7/ Julia] is a programming language, that aims to create an unprecedented combination of ease-of-use, power, and efficiency in a single language.
[https://julialang.org/ Julia] is a programming language, that aims to create an unprecedented combination of ease-of-use, power, and efficiency in a single language.


== Installation And Versions ==
== Installation And Versions ==
Line 5: Line 5:


== Packages ==
== Packages ==
Julia packages can be installed via nix using the <code>julia.withPackages</code> function. For example:<syntaxhighlight lang="nix">
{pkgs, ...}:
let
  myjulia = (pkgs.julia.withPackages [
    "Plots"
  ]);
in
{
environment.systemPackages = [ myjulia ];
home.packages = [ myjulia ]; # if using home manager
}
</syntaxhighlight>
You can also install packages the [https://docs.julialang.org/en/v1/stdlib/Pkg/ without nix.]
Some Julia packages expect binaries to be installed on your system. Until a better solution is found, you can run Julia inside [[Distrobox]].
Some Julia packages expect binaries to be installed on your system. Until a better solution is found, you can run Julia inside [[Distrobox]].


Most notably, Julia Plots does not work. You can use [http://gadflyjl.org/stable/ Gadfly] instead.
Most notably, Julia Plots does not work. You can use [http://gadflyjl.org/stable/ Gadfly] instead.
As of April 2026, the above statement is no longer accurate. [https://docs.juliaplots.org/stable/ Julia Plots] does seem to work with no additional configuration.


Another solution is to enable [https://github.com/nix-community/nix-ld nix-ld], see also [https://nix.dev/guides/faq#how-to-run-non-nix-executables here].
Another solution is to enable [https://github.com/nix-community/nix-ld nix-ld], see also [https://nix.dev/guides/faq#how-to-run-non-nix-executables here].


[[Category:Languages]]
[[Category:Languages]]