143 lines
4.3 KiB
Nix
143 lines
4.3 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/e4ad989506ec7d71f7302cc3067abd82730a4beb";
|
|
inputs.bscpkgs.url = "git+https://git.sr.ht/~rodarima/bscpkgs?ref=riscv-benchmarks";
|
|
# When changing bscpkgs, take directly from disk to avoid having to push:
|
|
#inputs.bscpkgs.url = "/home/Computational/rarias/bscpkgs";
|
|
|
|
outputs = {self,...}@inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
remoteNixpkgsPatches = [
|
|
{
|
|
meta.description = "sha256-ZCDQ7SpGhH8JvAwWzdcyrc68RFEWHxxAj0M2+AvEzIg=";
|
|
url = "https://github.com/NixOS/nixpkgs/pull/283460.diff";
|
|
sha256 = "sha256-g6o4rqkOOYZ6OJTzv9kTPq9Zsu5Z1QXZmPLC3Q7Sq6w=";
|
|
}
|
|
];
|
|
originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
|
|
nixpkgs = originPkgs.applyPatches {
|
|
name = "nixpkgs-patched";
|
|
src = inputs.nixpkgs;
|
|
patches = map originPkgs.fetchpatch remoteNixpkgsPatches;
|
|
};
|
|
nixosSystem = import (nixpkgs + "/nixos/lib/eval-config.nix");
|
|
|
|
|
|
in {
|
|
#overlay = import ./overlay.nix;
|
|
nixosConfigurations = {
|
|
# The qemu configuration defines a system that runs in the RISC-V
|
|
# architecture, but is build from an x86 host machine.
|
|
qemu = nixosSystem {
|
|
specialArgs = { inherit self; };
|
|
system = "${system}";
|
|
modules = [
|
|
./configuration.nix
|
|
./vm.nix
|
|
];
|
|
};
|
|
|
|
# Same, but disable compressed instructions
|
|
qemu-nc = nixosSystem {
|
|
specialArgs = { inherit self; };
|
|
system = "${system}";
|
|
modules = [
|
|
./configuration.nix
|
|
./vm.nix
|
|
./no-compressed.nix
|
|
];
|
|
};
|
|
|
|
# FPGA Lagarto Hun CPU
|
|
lagarto-hun = nixosSystem {
|
|
specialArgs = { inherit self; };
|
|
system = "${system}";
|
|
modules = [
|
|
./configuration.nix
|
|
./lagarto-hun.nix
|
|
./no-compressed.nix
|
|
];
|
|
};
|
|
|
|
# FPGA Lagarto Ox CPU
|
|
lagarto-ox = nixosSystem {
|
|
specialArgs = { inherit self; };
|
|
system = "${system}";
|
|
modules = [
|
|
./configuration.nix
|
|
./lagarto-ox.nix
|
|
./no-compressed.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
# A development shell with QEMU ready to boot the RISC-V system in an x86
|
|
# machine.
|
|
devShells.x86_64-linux.default =
|
|
let
|
|
nixosconf = self.nixosConfigurations.qemu-nc;
|
|
syspkgs = nixosconf.pkgs;
|
|
toplevel = nixosconf.config.system.build.toplevel;
|
|
in syspkgs.mkShell {
|
|
pname = "qemu-shell";
|
|
nativeBuildInputs = with syspkgs; [ qemu e2fsprogs ];
|
|
# Here we tell the run script where to find the system
|
|
NIXOS_SYSTEM_TOPLEVEL = toplevel;
|
|
OPENSBI = syspkgs.opensbi-uboot;
|
|
};
|
|
devShells.x86_64-linux.lagarto-hun =
|
|
let
|
|
nixosconf = self.nixosConfigurations.lagarto-hun;
|
|
syspkgs = nixosconf.pkgs;
|
|
build = nixosconf.config.system.build;
|
|
in syspkgs.mkShell {
|
|
pname = "lagarto-hun-shell";
|
|
TOPLEVEL = build.toplevel;
|
|
OPENSBI = syspkgs.opensbi;
|
|
KERNEL = build.kernel;
|
|
INITRD = build.initialRamdisk;
|
|
ROOTFS = build.sdImage;
|
|
UBOOT_ENV = syspkgs.uboot-env;
|
|
shellHook = ''
|
|
echo "Here are the current system pieces:"
|
|
echo " TOPLEVEL = $TOPLEVEL"
|
|
echo " KERNEL = $KERNEL"
|
|
echo " OPENSBI = $OPENSBI"
|
|
echo " INITRD = $INITRD"
|
|
echo " ROOTFS = $ROOTFS"
|
|
echo " UBOOT_ENV = $UBOOT_ENV"
|
|
'';
|
|
};
|
|
|
|
devShells.x86_64-linux.lagarto-ox =
|
|
let
|
|
nixosconf = self.nixosConfigurations.lagarto-ox;
|
|
syspkgs = nixosconf.pkgs;
|
|
build = nixosconf.config.system.build;
|
|
in syspkgs.mkShell {
|
|
pname = "lagarto-ox-shell";
|
|
TOPLEVEL = build.toplevel;
|
|
OPENSBI = syspkgs.opensbi;
|
|
KERNEL = build.kernel;
|
|
INITRD = build.initialRamdisk;
|
|
ROOTFS = build.sdImage;
|
|
UBOOT_ENV = syspkgs.uboot-env;
|
|
shellHook = ''
|
|
echo "Here are the current system pieces:"
|
|
echo " TOPLEVEL = $TOPLEVEL"
|
|
echo " KERNEL = $KERNEL"
|
|
echo " OPENSBI = $OPENSBI"
|
|
echo " INITRD = $INITRD"
|
|
echo " ROOTFS = $ROOTFS"
|
|
echo " UBOOT_ENV = $UBOOT_ENV"
|
|
'';
|
|
};
|
|
|
|
devShells.x86_64-linux.lagarto-ox-rd =
|
|
self.outputs.devShells.x86_64-linux.lagarto-ox.overrideAttrs (old:{
|
|
TOPLEVEL = "";
|
|
ROOTFS = "";
|
|
});
|
|
};
|
|
}
|