2022-06-25 17:37:18 +02:00
|
|
|
{
|
2024-07-05 16:30:29 +02:00
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2024-06-05 14:24:29 +02:00
|
|
|
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";
|
2023-02-16 11:57:52 +01:00
|
|
|
|
2024-07-05 16:30:29 +02:00
|
|
|
outputs = {self, nixpkgs, ...}@inputs:
|
2024-01-17 18:22:30 +01:00
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
2024-05-28 18:12:14 +02:00
|
|
|
nixosSystem = import (nixpkgs + "/nixos/lib/eval-config.nix");
|
2024-01-17 18:22:30 +01:00
|
|
|
in {
|
2024-05-13 18:59:00 +02:00
|
|
|
#overlay = import ./overlay.nix;
|
2024-01-17 18:22:30 +01:00
|
|
|
nixosConfigurations = {
|
2024-01-24 12:50:41 +01:00
|
|
|
# The qemu configuration defines a system that runs in the RISC-V
|
2024-01-17 18:22:30 +01:00
|
|
|
# architecture, but is build from an x86 host machine.
|
2024-05-28 18:12:14 +02:00
|
|
|
qemu = nixosSystem {
|
2024-05-13 18:59:00 +02:00
|
|
|
specialArgs = { inherit self; };
|
2024-01-24 12:50:41 +01:00
|
|
|
system = "${system}";
|
|
|
|
modules = [
|
|
|
|
./configuration.nix
|
|
|
|
./vm.nix
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Same, but disable compressed instructions
|
2024-05-28 18:12:14 +02:00
|
|
|
qemu-nc = nixosSystem {
|
2024-05-13 18:59:00 +02:00
|
|
|
specialArgs = { inherit self; };
|
2024-01-17 18:22:30 +01:00
|
|
|
system = "${system}";
|
2024-01-24 12:50:41 +01:00
|
|
|
modules = [
|
|
|
|
./configuration.nix
|
|
|
|
./vm.nix
|
|
|
|
./no-compressed.nix
|
2024-01-17 18:22:30 +01:00
|
|
|
];
|
2022-07-09 05:28:56 +02:00
|
|
|
};
|
2024-03-01 18:33:30 +01:00
|
|
|
|
|
|
|
# FPGA Lagarto Hun CPU
|
2024-05-28 18:12:14 +02:00
|
|
|
lagarto-hun = nixosSystem {
|
2024-05-13 18:59:00 +02:00
|
|
|
specialArgs = { inherit self; };
|
2024-03-01 18:33:30 +01:00
|
|
|
system = "${system}";
|
|
|
|
modules = [
|
|
|
|
./configuration.nix
|
|
|
|
./lagarto-hun.nix
|
2024-03-04 14:44:49 +01:00
|
|
|
./no-compressed.nix
|
2024-03-01 18:33:30 +01:00
|
|
|
];
|
|
|
|
};
|
2024-06-25 11:11:05 +02:00
|
|
|
|
|
|
|
# FPGA Lagarto Ox CPU
|
|
|
|
lagarto-ox = nixosSystem {
|
|
|
|
specialArgs = { inherit self; };
|
|
|
|
system = "${system}";
|
|
|
|
modules = [
|
|
|
|
./configuration.nix
|
|
|
|
./lagarto-ox.nix
|
|
|
|
./no-compressed.nix
|
|
|
|
];
|
|
|
|
};
|
2024-01-17 18:22:30 +01:00
|
|
|
};
|
2023-02-16 12:49:58 +01:00
|
|
|
|
2024-01-17 18:22:30 +01:00
|
|
|
# A development shell with QEMU ready to boot the RISC-V system in an x86
|
|
|
|
# machine.
|
2024-09-12 10:30:56 +02:00
|
|
|
devShells.x86_64-linux.qemu-lagarto-hun =
|
2024-01-17 18:22:30 +01:00
|
|
|
let
|
2024-01-24 12:50:41 +01:00
|
|
|
nixosconf = self.nixosConfigurations.qemu-nc;
|
2024-01-17 18:22:30 +01:00
|
|
|
syspkgs = nixosconf.pkgs;
|
2024-01-19 12:32:06 +01:00
|
|
|
toplevel = nixosconf.config.system.build.toplevel;
|
2024-05-13 18:59:00 +02:00
|
|
|
in syspkgs.mkShell {
|
2024-01-17 18:22:30 +01:00
|
|
|
pname = "qemu-shell";
|
2024-05-28 18:12:14 +02:00
|
|
|
nativeBuildInputs = with syspkgs; [ qemu e2fsprogs ];
|
2024-01-17 18:22:30 +01:00
|
|
|
# Here we tell the run script where to find the system
|
2024-01-17 18:33:58 +01:00
|
|
|
NIXOS_SYSTEM_TOPLEVEL = toplevel;
|
2024-01-18 17:58:00 +01:00
|
|
|
OPENSBI = syspkgs.opensbi-uboot;
|
2022-06-25 17:37:18 +02:00
|
|
|
};
|
2024-09-12 10:30:56 +02:00
|
|
|
|
2024-03-04 18:32:25 +01:00
|
|
|
devShells.x86_64-linux.lagarto-hun =
|
|
|
|
let
|
|
|
|
nixosconf = self.nixosConfigurations.lagarto-hun;
|
|
|
|
syspkgs = nixosconf.pkgs;
|
|
|
|
build = nixosconf.config.system.build;
|
2024-05-13 18:59:00 +02:00
|
|
|
in syspkgs.mkShell {
|
2024-03-04 18:32:25 +01:00
|
|
|
pname = "lagarto-hun-shell";
|
2024-03-07 16:49:48 +01:00
|
|
|
TOPLEVEL = build.toplevel;
|
2024-03-04 18:32:25 +01:00
|
|
|
OPENSBI = syspkgs.opensbi;
|
|
|
|
KERNEL = build.kernel;
|
|
|
|
INITRD = build.initialRamdisk;
|
2024-03-07 12:05:10 +01:00
|
|
|
ROOTFS = build.sdImage;
|
2024-03-07 16:49:48 +01:00
|
|
|
UBOOT_ENV = syspkgs.uboot-env;
|
2024-06-05 14:49:51 +02:00
|
|
|
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"
|
|
|
|
'';
|
2024-03-04 18:32:25 +01:00
|
|
|
};
|
2024-06-25 11:11:05 +02:00
|
|
|
|
|
|
|
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";
|
2024-07-01 10:14:39 +02:00
|
|
|
TOPLEVEL = build.toplevel;
|
2024-06-25 11:11:05 +02:00
|
|
|
OPENSBI = syspkgs.opensbi;
|
|
|
|
KERNEL = build.kernel;
|
|
|
|
INITRD = build.initialRamdisk;
|
2024-07-01 10:14:39 +02:00
|
|
|
ROOTFS = build.sdImage;
|
2024-06-25 11:11:05 +02:00
|
|
|
UBOOT_ENV = syspkgs.uboot-env;
|
2024-07-08 13:32:29 +02:00
|
|
|
BITSTREAM = syspkgs.bitstream;
|
2024-07-08 17:37:46 +02:00
|
|
|
BOOTROM = syspkgs.bootrom;
|
2024-06-25 11:11:05 +02:00
|
|
|
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"
|
2024-07-08 13:32:29 +02:00
|
|
|
echo " BITSTREAM = $BITSTREAM"
|
2024-07-08 17:37:46 +02:00
|
|
|
echo " BOOTROM = $BOOTROM"
|
2024-06-25 11:11:05 +02:00
|
|
|
'';
|
|
|
|
};
|
2024-07-03 18:45:26 +02:00
|
|
|
|
|
|
|
devShells.x86_64-linux.lagarto-ox-rd =
|
|
|
|
self.outputs.devShells.x86_64-linux.lagarto-ox.overrideAttrs (old:{
|
|
|
|
TOPLEVEL = "";
|
|
|
|
ROOTFS = "";
|
|
|
|
});
|
2024-09-12 10:30:56 +02:00
|
|
|
|
|
|
|
devShells.x86_64-linux.default =
|
|
|
|
self.outputs.devShells.x86_64-linux.lagarto-ox-rd;
|
2024-01-17 18:22:30 +01:00
|
|
|
};
|
2022-06-25 17:37:18 +02:00
|
|
|
}
|