nixos-riscv/flake.nix
Rodrigo Arias Mallo 483ad2944b Format the qcow2 image with ext4
The image needs to be available to the guest with a partition table and
a partition with a label named "nixos" so the stage1 can mount it. By
enabling the virtualisation.diskImage option we now have a persistent
root filesystem, including /home.
2024-01-25 15:34:59 +01:00

49 lines
1.3 KiB
Nix

{
inputs.nixpkgs.url = "github:rodarima/nixpkgs/fix-pkgs-static-gcc-march";
outputs = { self, nixpkgs, ... }:
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
# 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 {
system = "${system}";
modules = [
./configuration.nix
./vm.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 pkgs.mkShell {
pname = "qemu-shell";
buildInputs = with pkgs; [ qemu e2fsprogs ];
# Here we tell the run script where to find the system
NIXOS_SYSTEM_TOPLEVEL = toplevel;
OPENSBI = syspkgs.opensbi-uboot;
};
};
}