nixos-riscv/old-flake.nix
2024-01-17 18:22:30 +01:00

64 lines
1.9 KiB
Nix

{
inputs = {
nixpkgs.url = "github:matthewcroughan/nixpkgs/mc/riscv-testing";
# VisionFive ("v1")
vendor-kernel = {
url = "github:starfive-tech/linux";
flake = false;
};
};
outputs = { self, nixpkgs, vendor-kernel, ... }:
let
inherit (nixpkgs) lib;
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; };
modules = [
{ nixpkgs.overlays = [ self.overlay ]; }
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-riscv64-visionfive-installer.nix"
./base.nix
./configuration.nix
];
in
{
overlay = final: prev: {
linuxPackages_visionfive = final.linuxPackagesFor (
(
final.callPackage ./kernel.nix { inherit vendor-kernel; }
).override {
patches = [];
}
);
};
legacyPackages.${system} =
{
inherit (pkgs.pkgsCross.riscv64.linux) linuxPackages_visionfive;
};
images = {
visionfive-cross = self.nixosConfigurations.visionfive-cross.config.system.build.sdImage;
visionfive-native = self.nixosConfigurations.visionfive-native.config.system.build.sdImage;
visionfive2-cross = self.nixosConfigurations.visionfive2-cross.config.system.build.sdImage;
visionfive2-native = self.nixosConfigurations.visionfive2-native.config.system.build.sdImage;
};
nixosConfigurations = {
visionfive-cross = nixpkgs.lib.nixosSystem {
system = "${system}";
modules = modules ++ [
{
nixpkgs.crossSystem = {
gcc.arch = "rv64gv";
gcc.tune = "rv64gv";
system = "riscv64-linux";
};
}
];
};
visionfive-native = nixpkgs.lib.nixosSystem {
system = "riscv64-linux";
modules = modules;
};
};
};
}