From a2033071081895f545b56b288278918bbf16ca5a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 6 Jun 2019 17:25:11 +0800 Subject: [PATCH] reorganize --- default.nix | 32 ++++++++++++++++++++++++++------ derivations.nix | 22 ---------------------- examples/helloworld_ecp5.nix | 7 +++---- examples/helloworld_kintex7.nix | 7 +++---- examples/simplesoc_ecp5.nix | 7 +++---- release.nix | 10 +++++----- 6 files changed, 40 insertions(+), 45 deletions(-) delete mode 100644 derivations.nix diff --git a/default.nix b/default.nix index bc8405c..72034e0 100644 --- a/default.nix +++ b/default.nix @@ -1,8 +1,28 @@ { pkgs }: -let - hx = import ./derivations.nix { inherit pkgs; }; -in - hx // { - symbiflow = import ./eda/symbiflow.nix { inherit pkgs; yosys = hx.yosys; }; +rec { + drvs = rec { + yosys = pkgs.callPackage ./eda/yosys.nix {}; + symbiyosys = pkgs.symbiyosys.override { inherit yosys; }; + nmigen = pkgs.callPackage ./eda/nmigen.nix { inherit yosys; }; + scala-spinalhdl = pkgs.callPackage ./eda/scala-spinalhdl.nix {}; + + jtagtap = pkgs.callPackage ./cores/jtagtap.nix { inherit nmigen; }; + minerva = pkgs.callPackage ./cores/minerva.nix { inherit nmigen; inherit jtagtap; }; + vexriscv-small = pkgs.callPackage ./cores/vexriscv.nix { + inherit scala-spinalhdl; + name = "vexriscv-small"; + scalaToRun = "vexriscv.demo.GenSmallAndProductive"; + }; + + heavycomps = pkgs.callPackage ./heavycomps.nix { inherit nmigen; }; + + binutils-riscv = pkgs.callPackage ./compilers/binutils.nix { platform = "riscv32"; }; + rust-riscv32imc-crates = pkgs.callPackage ./compilers/rust-riscv32imc-crates.nix { }; + + helloworld = pkgs.callPackage ./firmware { inherit rust-riscv32imc-crates binutils-riscv; }; + }; + lib = { + symbiflow = import ./eda/symbiflow.nix { inherit pkgs; inherit (drvs) yosys; }; vivado = import ./eda/vivado.nix { inherit pkgs; }; - } + }; +} diff --git a/derivations.nix b/derivations.nix deleted file mode 100644 index df22d6f..0000000 --- a/derivations.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs }: -rec { - yosys = pkgs.callPackage ./eda/yosys.nix {}; - symbiyosys = pkgs.symbiyosys.override { inherit yosys; }; - nmigen = pkgs.callPackage ./eda/nmigen.nix { inherit yosys; }; - scala-spinalhdl = pkgs.callPackage ./eda/scala-spinalhdl.nix {}; - - jtagtap = pkgs.callPackage ./cores/jtagtap.nix { inherit nmigen; }; - minerva = pkgs.callPackage ./cores/minerva.nix { inherit nmigen; inherit jtagtap; }; - vexriscv-small = pkgs.callPackage ./cores/vexriscv.nix { - inherit scala-spinalhdl; - name = "vexriscv-small"; - scalaToRun = "vexriscv.demo.GenSmallAndProductive"; - }; - - heavycomps = pkgs.callPackage ./heavycomps.nix { inherit nmigen; }; - - binutils-riscv = pkgs.callPackage ./compilers/binutils.nix { platform = "riscv32"; }; - rust-riscv32imc-crates = pkgs.callPackage ./compilers/rust-riscv32imc-crates.nix { }; - - helloworld = pkgs.callPackage ./firmware { inherit rust-riscv32imc-crates binutils-riscv; }; -} diff --git a/examples/helloworld_ecp5.nix b/examples/helloworld_ecp5.nix index 98fc76a..7cca97b 100644 --- a/examples/helloworld_ecp5.nix +++ b/examples/helloworld_ecp5.nix @@ -1,9 +1,8 @@ -{ pkgs ? import {} -, hx ? import ../default.nix { inherit pkgs; }}: +{ pkgs, hx }: let symbiflowInput = pkgs.runCommand "helloworld-symbiflow-input" { - buildInputs = [ (pkgs.python3.withPackages(ps: [hx.nmigen hx.heavycomps])) hx.yosys ]; + buildInputs = [ (pkgs.python3.withPackages(ps: [hx.drvs.nmigen hx.drvs.heavycomps])) hx.drvs.yosys ]; } '' mkdir $out @@ -20,7 +19,7 @@ let echo -n "--um-45k --speed 8 --package CABGA381" > $out/device ''; in - hx.symbiflow.buildBitstream { + hx.lib.symbiflow.buildBitstream { name = "helloworld-bitstream"; src = symbiflowInput; } diff --git a/examples/helloworld_kintex7.nix b/examples/helloworld_kintex7.nix index 8965304..c6add0a 100644 --- a/examples/helloworld_kintex7.nix +++ b/examples/helloworld_kintex7.nix @@ -1,9 +1,8 @@ -{ pkgs ? import {} -, hx ? import ../default.nix { inherit pkgs; }}: +{ pkgs, hx }: let vivadoInput = pkgs.runCommand "helloworld-vivado-input" { - buildInputs = [ (pkgs.python3.withPackages(ps: [hx.nmigen hx.heavycomps])) hx.yosys ]; + buildInputs = [ (pkgs.python3.withPackages(ps: [hx.drvs.nmigen hx.drvs.heavycomps])) hx.drvs.yosys ]; } '' mkdir $out @@ -42,7 +41,7 @@ let EOF ''; in - hx.vivado.buildBitstream { + hx.lib.vivado.buildBitstream { name = "helloworld-bitstream"; src = vivadoInput; } diff --git a/examples/simplesoc_ecp5.nix b/examples/simplesoc_ecp5.nix index 9935c1a..3ec7526 100644 --- a/examples/simplesoc_ecp5.nix +++ b/examples/simplesoc_ecp5.nix @@ -1,9 +1,8 @@ -{ pkgs ? import {} -, hx ? import ../default.nix { inherit pkgs; }}: +{ pkgs, hx }: let symbiflowInput = pkgs.runCommand "simplesoc-symbiflow-input" { - buildInputs = [ (pkgs.python3.withPackages(ps: [hx.nmigen hx.heavycomps hx.minerva])) hx.yosys ]; + buildInputs = [ (pkgs.python3.withPackages(ps: [hx.drvs.nmigen hx.drvs.heavycomps hx.drvs.minerva])) hx.drvs.yosys ]; } '' mkdir $out @@ -20,7 +19,7 @@ let echo -n "--um-45k --speed 8 --package CABGA381" > $out/device ''; in - hx.symbiflow.buildBitstream { + hx.lib.symbiflow.buildBitstream { name = "simplesoc-bitstream"; src = symbiflowInput; } diff --git a/release.nix b/release.nix index 60950f2..6288962 100644 --- a/release.nix +++ b/release.nix @@ -1,13 +1,13 @@ { }: let pkgs = import { overlays = [ (import ./overlay.nix) ]; }; - derivations = import ./derivations.nix { inherit pkgs; }; - jobs = derivations // { + hx = import ./default.nix { inherit pkgs; }; + jobs = hx.drvs // { inherit (pkgs) llvm_7 rustc cargo cargo-vendor; - helloworld_ecp5 = import ./examples/helloworld_ecp5.nix { inherit pkgs; }; - helloworld_kintex7 = import ./examples/helloworld_kintex7.nix { inherit pkgs; }; - simplesoc_ecp5 = import ./examples/simplesoc_ecp5.nix { inherit pkgs; }; + helloworld_ecp5 = import ./examples/helloworld_ecp5.nix { inherit pkgs hx; }; + helloworld_kintex7 = import ./examples/helloworld_kintex7.nix { inherit pkgs hx; }; + simplesoc_ecp5 = import ./examples/simplesoc_ecp5.nix { inherit pkgs hx; }; }; in builtins.mapAttrs (name: value: pkgs.lib.hydraJob value) jobs