Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 2023.2 and 2024.1 #6

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 116 additions & 95 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,100 +10,121 @@
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... } @ inputs:
flake-utils.lib.eachSystem [ "x86_64-linux" ]
(system:
let
# checkout of the nixpkgs
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
# https://github.com/NixOS/nixpkgs/pull/42637
(final: prev: {
requireFile = args: (prev.requireFile args).overrideAttrs (_: { allowSubstitutes = true; });
})

self.overlays.default

inputs.devshell.overlays.default
];
outputs =
{
self,
nixpkgs,
flake-utils,
treefmt-nix,
...
}@inputs:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system:
let
# checkout of the nixpkgs
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
# https://github.com/NixOS/nixpkgs/pull/42637
(final: prev: {
requireFile =
args:
(prev.requireFile args).overrideAttrs (_: {
allowSubstitutes = true;
});
})

self.overlays.default

inputs.devshell.overlays.default
];
};

treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
rec {
packages = {
xilinx-unified-unwraped = pkgs.xilinx-unified-unwrapped;
xilinx-unified = pkgs.xilinx-unified;

# Add future version here

xilinx-unified-2024-1-unwraped = pkgs.xilinx-unified-2024-1-unwrapped;
xilinx-unified-2024-1 = pkgs.xilinx-unified-2024-1;

xilinx-unified-2023-2-unwraped = pkgs.xilinx-unified-2023-2-unwrapped;
xilinx-unified-2023-2 = pkgs.xilinx-unified-2023-2;

xilinx-unified-2023-1-unwraped = pkgs.xilinx-unified-2023-1-unwrapped;
xilinx-unified-2023-1 = pkgs.xilinx-unified-2023-1;

xilinx-vivado-2019-2-unwraped = pkgs.xilinx-vivado-2019-2-unwrapped;
xilinx-vivado-2019-2 = pkgs.xilinx-vivado-2019-2;

xilinx-fhs = pkgs.genXilinxFhs { runScript = ""; };
};

devShells.default = pkgs.devshell.mkShell {
imports = [ "${inputs.devshell}/extra/git/hooks.nix" ];
name = "xilinx-dev-shell";
packages = [
pkgs.coreutils
pkgs.glow
pkgs.python3
pkgs.unzip
pkgs.xilinx-vivado-2019-2
];
git.hooks = {
enable = true;
pre-commit.text = ''
nix flake check
'';
};

treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
rec {
packages = {
xilinx-unified-unwraped = pkgs.xilinx-unified-unwrapped;
xilinx-unified = pkgs.xilinx-unified;

xilinx-unified-2023-1-unwraped = pkgs.xilinx-unified-unwrapped;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets not assign an unspecific version to a specific one.

xilinx-unified-2023-1 = pkgs.xilinx-unified;

xilinx-vivado-2019-2-unwraped = pkgs.xilinx-vivado-2019-2-unwrapped;
xilinx-vivado-2019-2 = pkgs.xilinx-vivado-2019-2;

xilinx-fhs = pkgs.genXilinxFhs { runScript = ""; };
};

devShells.default = pkgs.devshell.mkShell {
imports = [ "${inputs.devshell}/extra/git/hooks.nix" ];
name = "xilinx-dev-shell";
packages = [
pkgs.coreutils
pkgs.glow
pkgs.python3
pkgs.unzip
pkgs.xilinx-vivado-2019-2
];
git.hooks = {
enable = true;
pre-commit.text = ''
nix flake check
commands =
let
commandTemplate = command: ''
set +u
exec ${./.}/commands/${command} "''${@}"
'';
};
commands =
let
commandTemplate = command: ''
set +u
exec ${./.}/commands/${command} "''${@}"
'';
commands = {
create-project = "creates a new project based on a template";
store = "create a restore script for a given project";
restore = "restore a project using a generated restore script";
build-hw-config = "generate a hw config for given platform";
build-bootloader = "build the bootloader for a script";
jtag-boot = "deploy a firmware via jtag";
launch-picocom = "launch the picocom serial monitor";
};
in
[
{
name = "show-readme";
command = ''glow "$PRJ_ROOT/README.md"'';
help = "";
}
] ++ (pkgs.lib.mapAttrsToList
(name: help: {
inherit name help;
command = commandTemplate name;
})
commands);
};


# for `nix fmt`
formatter = treefmtEval.config.build.wrapper;
# for `nix flake check`
checks = {
formatting = treefmtEval.config.build.check self;
shellcheck = pkgs.runCommand "shellcheck" { nativeBuildInputs = [ pkgs.shellcheck ]; }
"cd ${./.} && shellcheck commands/*; touch $out";
};

# just add every package as a hydra job
hydraJobs = checks // packages // (
commands = {
create-project = "creates a new project based on a template";
store = "create a restore script for a given project";
restore = "restore a project using a generated restore script";
build-hw-config = "generate a hw config for given platform";
build-bootloader = "build the bootloader for a script";
jtag-boot = "deploy a firmware via jtag";
launch-picocom = "launch the picocom serial monitor";
};
in
[
{
name = "show-readme";
command = ''glow "$PRJ_ROOT/README.md"'';
help = "";
}
]
++ (pkgs.lib.mapAttrsToList (name: help: {
inherit name help;
command = commandTemplate name;
}) commands);
};

# for `nix fmt`
formatter = treefmtEval.config.build.wrapper;
# for `nix flake check`
checks = {
formatting = treefmtEval.config.build.check self;
shellcheck = pkgs.runCommand "shellcheck" {
nativeBuildInputs = [ pkgs.shellcheck ];
} "cd ${./.} && shellcheck commands/*; touch $out";
};

# just add every package as a hydra job
hydraJobs =
checks
// packages
// (
let
cc = pkgs.checkCommands;
in
Expand All @@ -129,11 +150,11 @@
# toolchain = pkgs.xilinx-vivado-2019-2;
# platform = "zynq7000";
# };

}
);
}
) // {
}
)
// {
overlays.default = import ./overlay.nix;
};
}
32 changes: 32 additions & 0 deletions install-configs/xlnx-unified-2024-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#### Vitis Unified Software Platform Install Configuration ####
Edition=Vitis Unified Software Platform

Product=Vitis

# Path where AMD FPGAs & Adaptive SoCs software will be installed.
Destination=/tools/Xilinx

# Choose the Products/Devices the you would like to install.
Modules=Virtex UltraScale+ 58G:0,Install Devices for Kria SOMs and Starter Kits:1,Vitis IP Cache (Enable faster on-boarding for new users):0,Versal AI Edge Series ES1:0,Zynq-7000:1,Versal Prime Series ES1:0,Kintex UltraScale+:0,Artix UltraScale+:0,Spartan-7:0,Install devices for Alveo and edge acceleration platforms:0,Engineering Sample Devices for Custom Platforms:0,Vitis Networking P4:0,Artix-7:0,Zynq UltraScale+ MPSoC:1,Versal HBM Series ES1:0,DocNav:0,Versal HBM Series:0,Virtex UltraScale+ HBM:0,Kintex-7:0,Virtex UltraScale+:0,Versal AI Core Series:0,Versal AI Edge Series:0,Kintex UltraScale:0,Versal Premium Series:0,Virtex UltraScale:0,Versal Premium Series ES1:0,Zynq UltraScale+ RFSoC:0,Power Design Manager (PDM):0,Versal AI Core Series ES1:0,Versal Prime Series:0,Virtex-7:0,Virtex UltraScale+ HBM ES:0

# Choose the post install scripts you'd like to run as part of the finalization step. Please note that some of these scripts may require user interaction during runtime.
InstallOptions=

## Shortcuts and File associations ##
# Choose whether Start menu/Application menu shortcuts will be created or not.
CreateProgramGroupShortcuts=1

# Choose the name of the Start menu/Application menu shortcut. This setting will be ignored if you choose NOT to create shortcuts.
ProgramGroupFolder=Xilinx Design Tools

# Choose whether shortcuts will be created for All users or just the Current user. Shortcuts can be created for all users only if you run the installer as administrator.
CreateShortcutsForAllUsers=0

# Choose whether shortcuts will be created on the desktop or not.
CreateDesktopShortcuts=1

# Choose whether file associations will be created or not.
CreateFileAssociation=1

# Choose whether disk usage will be optimized (reduced) after installation
EnableDiskUsageOptimization=1
83 changes: 68 additions & 15 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,79 @@ final: prev: {

genXilinxFhs = final.callPackage ./pkgs/xilinx-fhs.nix { };

# Set default version here

xilinx-unified-unwrapped = final.xilinx-unified-2023-1-unwrapped;
xilinx-unified-unwrapped = final.xilinx-unified-2024-1-unwrapped;
xilinx-unified = final.callPackage ./pkgs/wrap-xilinx.nix {
inputDerivation = final.xilinx-unified-unwrapped;
};

xilinx-unified-2023-1-unwrapped = final.callPackage ./pkgs/xilinx-unified.nix { };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets define all versions here and do not rely on some defaults in the xilinx-unified derivation. So we dont have to change/add future versions in multiple files.

xilinx-unified-2023-1 = final.callPackage ./pkgs/wrap-xilinx.nix { inputDerivation = final.xilinx-unified-2023-1-unwrapped; };

xilinx-vivado-2019-2-unwrapped = (final.callPackage ./pkgs/xilinx-unified.nix {
agreements = [ "XilinxEULA" "3rdPartyEULA" "WebTalkTerms" ];
}).overrideAttrs (old: rec {
pname = "xilinx-vivado";
version = "2019.2_1106_2127";
src = final.requireFile {
name = "Xilinx_Vivado_${version}.tar.gz";
url = "https://www.xilinx.com/";
hash = "sha256-sGeBz7KUW6lI8Eo1nobWZmxkK+d2VidnxZ91FcqaDpY=";
};
});
# Add future version here

xilinx-unified-2024-1-unwrapped =
(final.callPackage ./pkgs/xilinx-unified.nix {
install_config = ./install-configs/xlnx-unified-2024-1.txt;
}).overrideAttrs
(old: rec {
pname = "xilinx-unified";
version = "2024.1_0522_2023";
src = final.requireFile {
name = "FPGAs_AdaptiveSoCs_Unified_${version}.tar.gz";
url = "https://www.xilinx.com/";
hash = "sha256-AH7MJNhTMnaCCENluF26orxVCiZU/RF9bNbaHAnH8QM=";
};
});
xilinx-unified-2024-1 = final.callPackage ./pkgs/wrap-xilinx.nix {
inputDerivation = final.xilinx-unified-2024-1-unwrapped;
};

xilinx-unified-2023-2-unwrapped =
(final.callPackage ./pkgs/xilinx-unified.nix { }).overrideAttrs
(old: rec {
pname = "xilinx-unified";
version = "2023.2_1013_2256";
src = final.requireFile {
name = "FPGAs_AdaptiveSoCs_Unified_${version}.tar.gz";
url = "https://www.xilinx.com/";
hash = "sha256-SCRztYAKux101RudvueXp19EPUBfxGqQMfMMIBa2r6o=";
};
});
xilinx-unified-2023-2 = final.callPackage ./pkgs/wrap-xilinx.nix {
inputDerivation = final.xilinx-unified-2023-2-unwrapped;
};

xilinx-unified-2023-1-unwrapped =
(final.callPackage ./pkgs/xilinx-unified.nix { }).overrideAttrs
(old: rec {
pname = "xilinx-unified";
version = "2023.1_0507_1903";
src = final.requireFile {
name = "Xilinx_Unified_${version}.tar.gz";
url = "https://www.xilinx.com/";
hash = "sha256-Kq7GwlDvdTP+X3+u1bjQUkcy7+7FNFnbOiIJXF87nDk=";
};
});
xilinx-unified-2023-1 = final.callPackage ./pkgs/wrap-xilinx.nix {
inputDerivation = final.xilinx-unified-2023-1-unwrapped;
};

xilinx-vivado-2019-2-unwrapped =
(final.callPackage ./pkgs/xilinx-unified.nix {
agreements = [
"XilinxEULA"
"3rdPartyEULA"
"WebTalkTerms"
];
}).overrideAttrs
(old: rec {
pname = "xilinx-vivado";
version = "2019.2_1106_2127";
src = final.requireFile {
name = "Xilinx_Vivado_${version}.tar.gz";
url = "https://www.xilinx.com/";
hash = "sha256-sGeBz7KUW6lI8Eo1nobWZmxkK+d2VidnxZ91FcqaDpY=";
};
});
xilinx-vivado-2019-2 = final.callPackage ./pkgs/wrap-xilinx.nix {
inputDerivation = final.xilinx-vivado-2019-2-unwrapped;
};
Expand Down
11 changes: 9 additions & 2 deletions pkgs/check-commands.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{ lib, stdenvNoCC, coreutils-full }:
{
lib,
stdenvNoCC,
coreutils-full,
}:

{ toolchain, platform }:

stdenvNoCC.mkDerivation (finalAttrs: {
name = "check-commands-${toolchain.name}-${platform}";

nativeBuildInputs = [ coreutils-full toolchain ];
nativeBuildInputs = [
coreutils-full
toolchain
];

dontUnpack = true;

Expand Down
7 changes: 6 additions & 1 deletion pkgs/wrap-xilinx.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ stdenvNoCC, makeWrapper, genXilinxFhs, inputDerivation }:
{
stdenvNoCC,
makeWrapper,
genXilinxFhs,
inputDerivation,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = inputDerivation.pname + "-wrapped";
Expand Down
Loading