Include Litex dependency
[soc.git] / flake.nix
1 # The license for this file is included in the `nix` directory next to this file.
2
3 {
4 description = "FOSS CPU/GPU/VPU/SoC all in one, see https://libre-soc.org/";
5
6 inputs.nixpkgs.url = "github:L-as/nixpkgs?ref=libresoc"; # for alliance and migen
7 inputs.c4m-jtag.url = "git+https://git.libre-soc.org/git/c4m-jtag.git";
8 inputs.c4m-jtag.flake = false;
9 inputs.nmigen.url = "git+https://git.libre-soc.org/git/nmigen.git";
10 inputs.nmigen.flake = false;
11 inputs.nmigen-soc.url = "git+https://git.libre-soc.org/git/nmigen-soc.git";
12 inputs.nmigen-soc.flake = false;
13 inputs.nix-litex.url = "github:L-as/tock-litex";
14 inputs.nix-litex.flake = false;
15
16 outputs = { self, nixpkgs, c4m-jtag, nmigen, nmigen-soc, nix-litex }:
17 let
18 getv = x: builtins.substring 0 8 x.lastModifiedDate;
19
20 supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
21
22 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
23
24 nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
25
26 litexPkgs = pkgs: import "${nix-litex}/pkgs" { inherit pkgs; };
27 in
28 {
29 overlay = final: prev: {
30 python3Packages = prev.python3Packages.override {
31 overrides = pfinal: pprev: {
32 libresoc-ieee754fpu = pfinal.callPackage ./nix/ieee754fpu.nix {};
33 libresoc-openpower-isa = pfinal.callPackage ./nix/openpower-isa.nix {};
34 c4m-jtag = pfinal.callPackage (import ./nix/c4m-jtag.nix { src = c4m-jtag; version = getv c4m-jtag; }) {};
35 bigfloat = pfinal.callPackage ./nix/bigfloat.nix {};
36 modgrammar = pfinal.callPackage ./nix/modgrammar.nix {};
37 libresoc-nmutil = pfinal.callPackage ./nix/nmutil.nix {};
38
39 nmigen-soc = pprev.nmigen-soc.overrideAttrs (_: {
40 doCheck = false;
41 src = nmigen-soc;
42 setuptoolsCheckPhase = "true";
43 });
44
45 nmigen = pprev.nmigen.overrideAttrs (_: {
46 src = nmigen;
47 });
48 };
49 };
50
51 libresoc-verilog = final.callPackage (import ./nix/verilog.nix { version = getv self; }) {};
52 libresoc-ilang = final.callPackage (import ./nix/ilang.nix { version = getv self; litexPkgs = litexPkgs final; }) {};
53 };
54
55 packages = forAllSystems (system: {
56 verilog = nixpkgsFor.${system}.libresoc-verilog;
57 ilang = nixpkgsFor.${system}.libresoc-ilang;
58 openpower-isa = nixpkgsFor.${system}.python3Packages.libresoc-openpower-isa;
59 });
60
61 defaultPackage = forAllSystems (system: self.packages.${system}.verilog);
62 };
63 }