nixos-riscv/flake.nix

58 lines
1.5 KiB
Nix
Raw Normal View History

2022-06-25 17:37:18 +02:00
{
inputs.nixpkgs.url = "github:rodarima/nixpkgs/fix-pkgs-static-gcc-march";
2023-02-16 11:57:52 +01:00
2024-01-24 12:53:10 +01:00
outputs = { self, nixpkgs, ... }:
2024-01-17 18:22:30 +01:00
let
system = "x86_64-linux";
overlay = import ./overlay.nix;
pkgs = import nixpkgs { inherit system; };
in {
overlay = import ./overlay.nix;
nixosConfigurations = {
# 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.
qemu = nixpkgs.lib.nixosSystem {
system = "${system}";
modules = [
./configuration.nix
./vm.nix
];
};
# Same, but disable compressed instructions
qemu-nc = nixpkgs.lib.nixosSystem {
2024-01-17 18:22:30 +01:00
system = "${system}";
modules = [
./configuration.nix
./vm.nix
./no-compressed.nix
2024-01-17 18:22:30 +01:00
];
};
2024-03-01 18:33:30 +01:00
# FPGA Lagarto Hun CPU
lagarto-hun = nixpkgs.lib.nixosSystem {
system = "${system}";
modules = [
./configuration.nix
./lagarto-hun.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.
devShells.x86_64-linux.default =
let
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-01-24 13:09:49 +01:00
in pkgs.mkShell {
2024-01-17 18:22:30 +01:00
pname = "qemu-shell";
buildInputs = with pkgs; [ 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-01-17 18:22:30 +01:00
};
2022-06-25 17:37:18 +02:00
}