From 1c8ebeb238cb7b11e620e2e554b2caf5d85852af Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 2 Apr 2025 02:59:21 +0300 Subject: [PATCH] Add initial flake --- flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ shell.nix | 14 ----------- 3 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..aa2e659 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1735821806, + "narHash": "sha256-cuNapx/uQeCgeuhUhdck3JKbgpsml259sjUQnWM7zW8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d6973081434f88088e5321f83ebafe9a1167c367", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d014baf --- /dev/null +++ b/flake.nix @@ -0,0 +1,69 @@ +{ + inputs = { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = + inputs: + inputs.utils.lib.eachDefaultSystem ( + system: + let + pkgs = import inputs.nixpkgs { + localSystem = system; + overlays = [ + (final: prev: { + + riscv-bluespec-classic = pkgs.callPackage ( + { + stdenv, + bluespec, + nextpnr, + openfpgaloader, + trellis, + which, + yosys, + TOPMODULE ? "mkTop", + makeFlags ? [ ], + }: + stdenv.mkDerivation { + pname = "riscv-bluespec-classic"; + version = "0.1.0"; + src = ./.; + + # Versions can be checked with + # `nix eval --json ".#bluespec-joh-template.nativeBuildInputs" | nix-shell -p jq --run jq` + nativeBuildInputs = [ + bluespec + nextpnr + openfpgaloader + trellis + which + yosys + ]; + + # TODO: Build and install something + + } + ) { }; + + }) + ]; + }; + in + { + packages = { + default = inputs.self.packages."${system}".riscv-bluespec-classic; + riscv-bluespec-classic = pkgs.riscv-bluespec-classic; + }; + + devShells.default = + with pkgs; + mkShell { + inputsFrom = [ riscv-bluespec-classic ]; + }; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 328453b..0000000 --- a/shell.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/d34a98666913267786d9ab4aa803a1fc75f81f4d.tar.gz") {} }: - -pkgs.mkShell { - buildInputs = [ - pkgs.yosys - pkgs.nextpnr - pkgs.bluespec - pkgs.yosys-bluespec - ]; - - shellHook = '' - echo "Dev environment for Manna Chip." - ''; -} \ No newline at end of file