2022-06-25 17:37:18 +02:00
{
inputs = {
2022-07-13 08:48:06 +02:00
nixpkgs . url = " g i t h u b : m a t t h e w c r o u g h a n / n i x p k g s / m c / r i s c v - t e s t i n g " ;
2023-02-16 11:57:52 +01:00
# VisionFive ("v1")
2022-07-09 05:28:56 +02:00
vendor-kernel = {
url = " g i t h u b : s t a r f i v e - t e c h / l i n u x " ;
flake = false ;
} ;
2022-06-25 17:37:18 +02:00
jh7100_ddrinit = {
url = " h t t p s : / / g i t h u b . c o m / s t a r f i v e - t e c h / J H 7 1 0 0 _ d d r i n i t / r e l e a s e s / d o w n l o a d / d d r i n i t - 2 1 3 3 - 2 1 1 1 0 2 / d d r i n i t - 2 1 3 3 - 2 1 1 1 0 2 . b i n . o u t " ;
flake = false ;
} ;
jh7100_secondBoot = {
url = " h t t p s : / / g i t h u b . c o m / s t a r f i v e - t e c h / J H 7 1 0 0 _ s e c o n d B o o t / r e l e a s e s / d o w n l o a d / b o o t l o a d e r - 2 1 1 1 0 2 _ V i s i o n F i v e _ J H 7 1 0 0 / b o o t l o a d e r - J H 7 1 0 0 - 2 1 1 1 0 2 . b i n . o u t " ;
flake = false ;
} ;
jh7100_recovery_binary = {
url = " h t t p s : / / g i t h u b . c o m / s t a r f i v e - t e c h / b o o t l o a d e r _ r e c o v e r y / r e l e a s e s / d o w n l o a d / J H 7 1 0 0 _ r e c o v e r y _ b i n a r y / j h 7 1 0 0 _ r e c o v e r y _ b o o t . b i n " ;
flake = false ;
} ;
jh71xx-tools = {
url = " g i t h u b : x y p r o n / j h 7 1 x x - t o o l s " ;
flake = false ;
} ;
2023-02-16 11:57:52 +01:00
# VisionFive 2
jh7110-kernel = {
# url = "github:starfive-tech/linux/50a831018ed997c9fb3b603574176b221a28aa12"; # JH7110_VisionFive2_devel via VisionFive2 project submodule about two revisions back.
url = " g i t h u b : s t a r f i v e - t e c h / l i n u x / J H 7 1 1 0 _ V i s i o n F i v e 2 _ d e v e l " ;
flake = false ;
} ;
jh7110_recovery_binary = {
url = " h t t p s : / / g i t h u b . c o m / s t a r f i v e - t e c h / T o o l s / b l o b / b c 6 d c 7 e 3 3 e 0 c 2 4 6 6 d b 0 4 7 6 b 5 0 4 3 f 0 f 7 7 8 4 2 f 9 8 f 0 / r e c o v e r y / j h 7 1 1 0 - r e c o v e r y - 2 0 2 2 1 2 0 5 . b i n ? r a w = t r u e " ;
flake = false ;
} ;
# Should be possible to build from https://github.com/starfive-tech/VisionFive2
jh7110_u-boot-spl-bin = {
url = https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.8.0/u-boot-spl.bin.normal.out ;
flake = false ;
} ;
jh7110_u-boot-bin = {
url = https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.8.0/visionfive2_fw_payload.img ;
flake = false ;
} ;
2022-06-25 17:37:18 +02:00
} ;
2023-02-16 12:49:58 +01:00
outputs = inputs @ { self , nixpkgs , jh71xx-tools , jh7100_recovery_binary , jh7100_secondBoot , jh7100_ddrinit , vendor-kernel , . . . }:
2022-06-25 17:37:18 +02:00
let
2023-02-16 12:49:58 +01:00
inherit ( nixpkgs ) lib ;
2022-07-09 05:24:16 +02:00
system = " x 8 6 _ 6 4 - l i n u x " ;
2022-07-09 05:28:56 +02:00
pkgs = import nixpkgs { inherit system ; overlays = [ self . overlay ] ; } ;
2022-06-25 17:37:18 +02:00
modules = [
2022-07-09 05:28:56 +02:00
{ nixpkgs . overlays = [ self . overlay ] ; }
2022-06-25 17:37:18 +02:00
" ${ nixpkgs } / n i x o s / m o d u l e s / i n s t a l l e r / s d - c a r d / s d - i m a g e - r i s c v 6 4 - v i s i o n f i v e - i n s t a l l e r . n i x "
./base.nix
./configuration.nix
] ;
2023-02-16 12:49:58 +01:00
# Pass arguments to a module inside a function inside a file, while preserving
# the file name behavior of the module system.
importApply =
modulePath : staticArgs :
lib . setDefaultModuleLocation modulePath ( import modulePath staticArgs ) ;
2022-06-25 17:37:18 +02:00
in
{
2022-07-09 05:28:56 +02:00
overlay = final : prev : {
linuxPackages_visionfive = final . linuxPackagesFor ( ( final . callPackage ./kernel.nix { inherit vendor-kernel ; } ) . override { patches = [ ] ; } ) ;
} ;
2022-07-09 05:29:20 +02:00
legacyPackages . ${ system } =
{
inherit ( pkgs . pkgsCross . riscv64 . linux ) linuxPackages_visionfive ;
} ;
2022-06-25 17:37:18 +02:00
images = {
2022-07-09 05:24:16 +02:00
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-02-16 12:49:58 +01:00
nixosModules = {
visionfive2-sd-image = importApply ./visionfive2/sd-image.nix { inherit inputs importApply ; } ;
visionfive2-kernel = importApply ./visionfive2/kernel/nixos-module.nix { inherit inputs importApply ; } ;
} ;
2023-11-27 11:41:05 +01:00
nixosConfigurations = {
2022-07-09 05:24:16 +02:00
visionfive-cross = nixpkgs . lib . nixosSystem {
system = " ${ system } " ;
2022-06-25 17:37:18 +02:00
modules = modules ++ [
{
nixpkgs . crossSystem = {
system = " r i s c v 6 4 - l i n u x " ;
} ;
}
] ;
} ;
visionfive-native = nixpkgs . lib . nixosSystem {
system = " r i s c v 6 4 - l i n u x " ;
modules = modules ;
} ;
} ;
} ;
}