flake: define system as a variable and use it
This commit is contained in:
parent
57d029a9a2
commit
c0cbf6cf02
17
flake.nix
17
flake.nix
@ -20,7 +20,8 @@
|
|||||||
};
|
};
|
||||||
outputs = { self, nixpkgs, jh71xx-tools, jh7100_recovery_binary, jh7100_secondBoot, jh7100_ddrinit }:
|
outputs = { self, nixpkgs, jh71xx-tools, jh7100_recovery_binary, jh7100_secondBoot, jh7100_ddrinit }:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
modules = [
|
modules = [
|
||||||
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-riscv64-visionfive-installer.nix"
|
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-riscv64-visionfive-installer.nix"
|
||||||
./base.nix
|
./base.nix
|
||||||
@ -28,7 +29,7 @@
|
|||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
apps.x86_64-linux = {
|
apps.${system} = {
|
||||||
flashBootloader =
|
flashBootloader =
|
||||||
let
|
let
|
||||||
expectScript = pkgs.writeScript "expect-visionfive.sh" ''
|
expectScript = pkgs.writeScript "expect-visionfive.sh" ''
|
||||||
@ -69,7 +70,7 @@
|
|||||||
flash() {
|
flash() {
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
${pkgs.lib.getExe self.packages.x86_64-linux.jh7100-recover} \
|
${pkgs.lib.getExe self.packages.${system}.jh7100-recover} \
|
||||||
-D $1 \
|
-D $1 \
|
||||||
-r ${jh7100_recovery_binary} \
|
-r ${jh7100_recovery_binary} \
|
||||||
-b ${jh7100_secondBoot} \
|
-b ${jh7100_secondBoot} \
|
||||||
@ -90,16 +91,16 @@
|
|||||||
program = "${program}";
|
program = "${program}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
packages.x86_64-linux = {
|
packages.${system} = {
|
||||||
jh7100-recover = pkgs.writeCBin "jh7100-recover" (builtins.readFile "${jh71xx-tools}/jh7100-recover.c");
|
jh7100-recover = pkgs.writeCBin "jh7100-recover" (builtins.readFile "${jh71xx-tools}/jh7100-recover.c");
|
||||||
};
|
};
|
||||||
images = {
|
images = {
|
||||||
visionfive-cross-x86 = self.nixosConfigurations.visionfive-cross-x86.config.system.build.sdImage;
|
visionfive-cross = self.nixosConfigurations.visionfive-cross.config.system.build.sdImage;
|
||||||
visionfive-native = self.nixosConfigurations.visionfive-cross-x86.config.system.build.sdImage;
|
visionfive-native = self.nixosConfigurations.visionfive-native.config.system.build.sdImage;
|
||||||
};
|
};
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
visionfive-cross-x86 = nixpkgs.lib.nixosSystem {
|
visionfive-cross = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "${system}";
|
||||||
modules = modules ++ [
|
modules = modules ++ [
|
||||||
{
|
{
|
||||||
nixpkgs.crossSystem = {
|
nixpkgs.crossSystem = {
|
||||||
|
Loading…
Reference in New Issue
Block a user