2022-06-25 17:37:18 +02:00
|
|
|
{
|
2024-01-24 10:21:08 +01:00
|
|
|
inputs.nixpkgs.url = "github:rodarima/nixpkgs/fix-pkgs-static-gcc-march";
|
2024-01-17 18:22:30 +01:00
|
|
|
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
|
2023-02-16 11:57:52 +01:00
|
|
|
|
2024-01-17 18:22:30 +01:00
|
|
|
# Some dependencies of this flake are not yet available on non linux systems
|
|
|
|
inputs.systems.url = "github:nix-systems/x86_64-linux";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
inputs.flake-utils.inputs.systems.follows = "systems";
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, nixos-hardware, flake-utils, ... }:
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
|
|
|
overlay = import ./overlay.nix;
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
in {
|
|
|
|
overlay = import ./overlay.nix;
|
|
|
|
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-01-24 12:50:41 +01:00
|
|
|
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}";
|
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-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
|
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;
|
|
|
|
#toplevel = "${nixosconf.config.system.build.vm}/system";
|
2024-01-17 18:22:30 +01:00
|
|
|
in
|
|
|
|
pkgs.mkShell {
|
|
|
|
pname = "qemu-shell";
|
|
|
|
buildInputs = with pkgs; [ qemu ];
|
|
|
|
# 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;
|
|
|
|
#OPENSBI = syspkgs.opensbi;
|
2022-06-25 17:37:18 +02:00
|
|
|
};
|
2024-01-17 18:22:30 +01:00
|
|
|
};
|
2022-06-25 17:37:18 +02:00
|
|
|
}
|
2024-01-17 18:22:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
# rec {
|
|
|
|
#
|
|
|
|
# # .\#nixosConfigurations.visionfive-cross.config.system.build.toplevel
|
|
|
|
# packages.default = packages.sd-image;
|
|
|
|
# packages.sd-image = (import "${nixpkgs}/nixos" {
|
|
|
|
# configuration =
|
|
|
|
# { config, ... }: {
|
|
|
|
# imports = [
|
|
|
|
# "${nixos-hardware}/starfive/visionfive/v2/sd-image-installer.nix"
|
|
|
|
# ];
|
|
|
|
#
|
|
|
|
# # If you want to use ssh set a password
|
|
|
|
# users.users.nixos.password = "test123";
|
|
|
|
# # OR add your public ssh key
|
|
|
|
# # users.users.nixos.openssh.authorizedKeys.keys = [ "ssh-rsa ..." ];
|
|
|
|
#
|
|
|
|
# # AND configure networking
|
|
|
|
# networking.interfaces.end0.useDHCP = true;
|
|
|
|
# networking.interfaces.end1.useDHCP = true;
|
|
|
|
#
|
|
|
|
# # Additional configuration goes here
|
|
|
|
#
|
|
|
|
# #hardware.deviceTree.overlays = [{
|
|
|
|
# # name = "8GB-patch";
|
|
|
|
# # dtsFile = "${nixos-hardware}/starfive/visionfive/v2/8gb-patch.dts";
|
|
|
|
# #}];
|
|
|
|
#
|
|
|
|
# #sdImage.compressImage = false;
|
|
|
|
#
|
|
|
|
# nixpkgs.crossSystem = {
|
|
|
|
# config = "riscv64-unknown-linux-gnu";
|
|
|
|
# system = "riscv64-linux";
|
|
|
|
# };
|
|
|
|
#
|
|
|
|
# system.stateVersion = "24.05";
|
|
|
|
# };
|
|
|
|
# inherit system;
|
|
|
|
# }).config.system.build.toplevel;
|
|
|
|
# });
|
|
|
|
#}
|