forked from simplemirrors/nix-xilinx
No description
- Nix 65.4%
- Shell 34.6%
|
|
||
|---|---|---|
| icons | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| common-gui-deps.nix | ||
| default.nix | ||
| flake.lock | ||
| flake.nix | ||
| install-gui-tools.adoc | ||
| install-petalinux.adoc | ||
| most-of-petalinux-installer.sh | ||
| README.adoc | ||
[WARNING]
====
This project is archived. I created it back when I had only a native NixOS
machine available for development on xilinx products. Now I'd recommend to use
an Ubuntu system, also for Petalinux related tools. If you are in a work
environment that includes mostly Windows machines, then use Windows' Subsystem
for Linux (WSL). That could also play nice alongside a
https://github.com/nix-community/NixOS-WSL[NixOS-WSL]. If you are using NixOS
as the main top level OS, try out https://distrobox.it/[distrobox].
====
= Xilinx & Petalinux for Nix users
:source-highlighter: rouge
This repo is a collection of files that should help Nix and NixOS users install
Xilinx' software tools imperatively. The tools that were currently tested, are:
- Vivado
- Vitis
- Petalinux
[WARNING]
====
Some programs included in the above products have been reported to be buggy,
and even crash the GUI. It'd be great to get help in debugging this, but for
now here is a list of known issues:
- https://gitlab.com/doronbehar/nix-xilinx/-/issues/3[XSCT]
- https://support.xilinx.com/s/question/0D54U00007tNuYnSAK/petalinux-fails-to-detect-my-gcc[`petalinux-build` issues]
Using `petalinux-config` and `petalinux-create` should still work though.
====
== How does it work?
The trick used to install and run all of Xilinx's tools is to use an _FHS_
environment. These are documented in Nixpkgs' manual
https://nixos.org/manual/nixpkgs/unstable/#sec-fhs-environments[here] (_FHS_
means https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard[_Filesystem
Hierarchy Standard]). This repository provides access to FHS shells with all
the dependencies you need to install and run Xilinx' tools. After you finish
installing Xilinx' tools from the FHS shell, you should be able to run them
from the same FHS shell as well.
This repository is structured as a Nix flake. Hence if you have Nix's `flakes`
and `nix-command`
https://nixos.org/manual/nix/unstable/contributing/experimental-features.html[`experimental-features`]
enabled, you can view the packages this repo exposes using:
....
nix search gitlab:doronbehar/nix-xilinx
....
The packages ending with `-shell` suffix are the FHS shells described above.
The other packages also rely upon the same FHS trick, but they provide
executables that launch Xilinx' tools, using the installation paths you chose
when installing the tools.
We'll assume in the rest of the documentation that you have enabled `flakes`
and `nix-command` experimental features. If you want to enable them
temperarily, add to any of the below `nix` command the arguments:
....
nix --option extra-experimental-features 'nix-command flakes' <other args>
....
=== Installing Vivado & Vitis
First, download the desired tool from
https://www.xilinx.com/support/download.html[here] - it should be a `.bin`
file. Then enter into an FHS environment with:
....
nix run gitlab:doronbehar/nix-xilinx#xilinx-shell
....
And follow the steps below (also printed when you enter the shell):
include::./install-gui-tools.adoc[]
=== Installing Petalinux
Download the installer from
https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html[here]
- it should be a `.run` file. Then enter into an FHS environment with:
....
nix run gitlab:doronbehar/nix-xilinx#petalinux-install-shell
....
And follow the steps below (also printed when you enter the shell):
include::./install-petalinux.adoc[]
=== Adding the executables and `.desktop` files to your system
Assuming the installations above went on successfully, you can run `vivado` /
`vitis` from the command line with:
....
nix run gitlab:doronbehar/nix-xilinx#vivado
....
And you can run any of the `petalinux-..` tools using (e.g):
....
nix shell gitlab:doronbehar/nix-xilinx#petalinux --command petalinux-create
....
It's likely you'd like to make the FHS environment survive garbage
collections and add a desktop launcher to your system. To do that you can
follow one of the following paths according to your setup.
==== For NixOS users with a flakes setup
[source,nix]
----
inputs = {
# ...
nix-xilinx = {
# Recommended if you also override the default nixpkgs flake, common among
# nixos-unstable users:
#inputs.nixpkgs.follows = "nixpkgs";
url = "gitlab:doronbehar/nix-xilinx";
};
# ...
outputs = { self, nixpkgs, nix-xilinx }:
let
flake-overlays = [
nix-xilinx.overlay
];
in {
nixosConfigurations = (
HOSTNAME = nixpkgs.lib.nixosSystem {
modules = [ (import ./configuration.nix flake-overlays) ]
};
};
};
};
----
And in `./configuration.nix`:
[source,nix]
----
# All overlays given by flakes
flake-overlays:
{ config, pkgs, options, lib, ... }:
{
nixpkgs.overlays = [
(
final: prev: {
# Your own overlays...
}
)
] ++ flake-overlays;
}
----
Example evaluated
https://gitlab.com/doronbehar/nixos-configs/-/blob/e28b5aaf86f21202a2b7daa05b098ee5ed85de6f/flake.nix#L5-16[here]
and
https://gitlab.com/doronbehar/nixos-configs/-/blob/e28b5aaf86f21202a2b7daa05b098ee5ed85de6f/configuration.nix#L74[here].
==== For NixOS users without a flakes setup
The following setup should also fit flake NixOS users.
Add to your `configration.nix` (untested, but should work):
[source,nix]
----
nixpkgs.overlays = let
nix-xilinx = import (builtins.fetchTarball "https://gitlab.com/doronbehar/nix-xilinx/-/archive/master/nix-xilinx-master.tar.gz");
in [
nix-xilinx.overlay
(
final: prev: {
# Your own overlays...
}
)
];
----
==== Home Manager setup
TODO
==== Usage in Other Flakes / `shell.nix`
Some people may wish to not install xilinx' tools globally, and only making it
part of the `buildInputs` of their project. Usually this paradigm follows along
with https://direnv.net/[`direnv`] +
https://nixos.wiki/wiki/Development_environment_with_nix-shell#Using_Direnv[`shell.nix`]
/ https://nixos.wiki/wiki/Flakes#Direnv_integration[`flake.nix`] setup. For
example you can create in your project a `shell.nix`, or define `devShell` in
your `flake.nix` similarly to this:
[source,nix]
----
{ pkgs, nix-xilinx }:
pkgs.mkShell {
buildInputs = (with nix-xilinx.packages.x86_64-linux; [
vivado
vitis
]);
# Define some probably useful environment variables
shellHook = nix-xilinx.shellHooksCommon;
}
----
Note that xilinx' tools still need to be installed in a user-writeable location
for this `shellHook` to work, as explained xref:#user-content-install[here].
== Previous work / Credits
This repository is mostly copy paste from
https://gitlab.com/doronbehar/nix-matlab[nix-matlab].