Add default.nix and shell.nix

This commit is contained in:
Artturin 2025-01-17 18:22:02 +02:00
parent f2c06c895c
commit a3191e4b7d
3 changed files with 65 additions and 0 deletions

48
default.nix Normal file
View file

@ -0,0 +1,48 @@
{
pkgs ? (import ./pkgs.nix { }),
}:
pkgs.callPackage (
{
stdenv,
bluespec,
nextpnr,
openfpgaloader,
trellis,
which,
yosys,
}:
stdenv.mkDerivation {
pname = "bluespec-joh-template";
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
];
makeFlags = [
"-C"
"ulx3s_fpga"
"mkTop.bit"
];
installPhase = ''
runHook preInstall
mkdir -p $out
cp ./ulx3s_fpga/mkTop.bit $out/
runHook postInstall
'';
passthru = { inherit pkgs; };
}
) { }

9
pkgs.nix Normal file
View file

@ -0,0 +1,9 @@
let
date = "2025-02-02";
rev = "3a228057f5b619feb3186e986dbe76278d707b6e";
sha256 = "0iqla32cwy147lx1jw84174qkf8jyd912vxqjfgggyil1k8fix66";
in
builtins.trace "(Using pinned Nixpkgs at ${rev} from ${date} nixos-unstable)" import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256;
})

8
shell.nix Normal file
View file

@ -0,0 +1,8 @@
let
bluespec-joh-template = import ./default.nix { };
pkgs = bluespec-joh-template.pkgs;
in
pkgs.mkShell {
inputsFrom = [ bluespec-joh-template ];
}