nixos-riscv/flake.nix

64 lines
1.9 KiB
Nix
Raw Normal View History

2022-06-25 17:37:18 +02:00
{
inputs = {
nixpkgs.url = "github:matthewcroughan/nixpkgs/mc/riscv-testing";
2023-02-16 11:57:52 +01:00
# VisionFive ("v1")
vendor-kernel = {
url = "github:starfive-tech/linux";
flake = false;
};
2022-06-25 17:37:18 +02:00
};
2023-11-29 10:48:59 +01:00
outputs = { self, nixpkgs, vendor-kernel, ... }:
2022-06-25 17:37:18 +02:00
let
2023-02-16 12:49:58 +01:00
inherit (nixpkgs) lib;
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; };
2022-06-25 17:37:18 +02:00
modules = [
{ nixpkgs.overlays = [ self.overlay ]; }
2022-06-25 17:37:18 +02:00
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-riscv64-visionfive-installer.nix"
./base.nix
./configuration.nix
];
in
{
overlay = final: prev: {
2023-11-29 10:48:59 +01:00
linuxPackages_visionfive = final.linuxPackagesFor (
(
final.callPackage ./kernel.nix { inherit vendor-kernel; }
).override {
patches = [];
}
);
};
legacyPackages.${system} =
{
inherit (pkgs.pkgsCross.riscv64.linux) linuxPackages_visionfive;
};
2022-06-25 17:37:18 +02:00
images = {
visionfive-cross = self.nixosConfigurations.visionfive-cross.config.system.build.sdImage;
visionfive-native = self.nixosConfigurations.visionfive-native.config.system.build.sdImage;
2023-02-16 12:49:58 +01:00
visionfive2-cross = self.nixosConfigurations.visionfive2-cross.config.system.build.sdImage;
visionfive2-native = self.nixosConfigurations.visionfive2-native.config.system.build.sdImage;
2022-06-25 17:37:18 +02:00
};
2023-11-27 11:41:05 +01:00
nixosConfigurations = {
visionfive-cross = nixpkgs.lib.nixosSystem {
system = "${system}";
2022-06-25 17:37:18 +02:00
modules = modules ++ [
{
nixpkgs.crossSystem = {
gcc.arch = "rv64gv";
gcc.tune = "rv64gv";
2022-06-25 17:37:18 +02:00
system = "riscv64-linux";
};
}
];
};
visionfive-native = nixpkgs.lib.nixosSystem {
system = "riscv64-linux";
modules = modules;
};
};
};
}