add litex

This commit is contained in:
saji 2024-04-18 11:58:49 -05:00
parent d6858716a0
commit 8bcb72013b
3 changed files with 66 additions and 4 deletions

View file

@ -7,13 +7,24 @@
outputs = inputs@{ nixpkgs, ... }:
let
# litex-overlay = final: prev: {
# pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
# (python-final: python-prev: {
# litex = python-final.callPackage (import ./litex.nix) { };
# # can add more packages here!
# })
# ];
# };
litex-overlay = import ./litex;
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
forAllSystems = function:
nixpkgs.lib.genAttrs systems (system: function (
import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = []; # patches, version pins here.
overlays = [
litex-overlay
]; # patches, version pins, new pkgs here.
}
));
@ -21,9 +32,12 @@
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
python3
python3Packages.cocotb
python3Packages.cocotb-bus
(python3.withPackages (ps: with ps; [
cocotb
cocotb-bus
litex
amaranth
]))
yosys
nextpnr
# simulators
@ -33,6 +47,7 @@
trellis
# loader
openfpgaloader
ecpdap # easier to poke probes.
];
};

11
litex/default.nix Normal file
View file

@ -0,0 +1,11 @@
# an overlay to
let
tag = "2023.12";
in final: prev: {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(python-final: python-prev: {
litex = python-final.callPackage(import ./litex.nix tag) { };
})
];
}

36
litex/litex.nix Normal file
View file

@ -0,0 +1,36 @@
tag: {
pkgs
, lib
, buildPythonPackage
, pyserial
, migen
, requests
, colorama
, packaging
, setuptools
}: buildPythonPackage {
pname = "litex";
version = "${tag}";
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "enjoy-digital";
repo = "litex";
rev = "${tag}";
hash = "sha256-OcwqYLQ7ec2vTewdIJqP/aTCJ4yI43OIOkTMD/hIKO0=";
};
buildInputs = [
setuptools
];
propagatedBuildInputs = [
migen
requests
pyserial
colorama
packaging
];
doCheck = false;
}