WIP
[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=alliance"; # for alliance
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
14 outputs = { self, nixpkgs, c4m-jtag, nmigen, nmigen-soc }:
15 let
16 getv = x: builtins.substring 0 8 x.lastModifiedDate;
17
18 supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
19
20 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
21
22 nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
23 in
24 {
25 overlay = final: prev: {
26 python3Packages = prev.python3Packages.override {
27 overrides = pfinal: pprev: {
28 libresoc-ieee754fpu = pfinal.callPackage ./nix/ieee754fpu.nix {};
29 libresoc-openpower-isa = pfinal.callPackage ./nix/openpower-isa.nix {};
30 c4m-jtag = pfinal.callPackage (import ./nix/c4m-jtag.nix { src = c4m-jtag; version = getv c4m-jtag; }) {};
31 bigfloat = pfinal.callPackage ./nix/bigfloat.nix {};
32 modgrammar = pfinal.callPackage ./nix/modgrammar.nix {};
33 libresoc-nmutil = pfinal.callPackage ./nix/nmutil.nix {};
34
35 nmigen-soc = pprev.nmigen-soc.overrideAttrs (_: {
36 doCheck = false;
37 src = nmigen-soc;
38 setuptoolsCheckPhase = "true";
39 });
40
41 nmigen = pprev.nmigen.overrideAttrs (_: {
42 src = nmigen;
43 });
44 };
45 };
46
47 libresoc-verilog = final.callPackage (import ./nix/verilog.nix { version = getv self; }) {};
48 libresoc-ilang = final.callPackage (import ./nix/ilang.nix { version = getv self; }) {};
49 };
50
51 packages = forAllSystems (system: {
52 verilog = nixpkgsFor.${system}.libresoc-verilog;
53 ilang = nixpkgsFor.${system}.libresoc-ilang;
54 openpower-isa = nixpkgsFor.${system}.python3Packages.libresoc-openpower-isa;
55 });
56
57 defaultPackage = forAllSystems (system: self.packages.${system}.verilog);
58 };
59 }