Update to use custom base image

This commit is contained in:
asonix 2023-01-12 19:11:53 -06:00
parent 1ee5ffb332
commit 9a30b2769b
4 changed files with 52 additions and 14 deletions

View file

@ -1,4 +1,5 @@
{ pkgs ? import <nixos-unstable> { } { pkgs ? import <nixos-unstable> { }
, aarch64-image
}: }:
let let
@ -7,7 +8,7 @@ let
}; };
buildImage = pkgs.callPackage ./pkgs/build-image { }; buildImage = pkgs.callPackage ./pkgs/build-image { };
aarch64Image = pkgs.callPackage ./pkgs/aarch64-image { }; aarch64Image = pkgs.callPackage ./pkgs/aarch64-image { aarch64-image = aarch64-image; };
rockchip = uboot: pkgs.callPackage ./images/rockchip.nix { rockchip = uboot: pkgs.callPackage ./images/rockchip.nix {
inherit uboot; inherit uboot;
inherit aarch64Image buildImage; inherit aarch64Image buildImage;

View file

@ -1,6 +1,40 @@
{ {
"nodes": { "nodes": {
"aarch64-linux-testing": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1673570754,
"narHash": "sha256-yI4UHNUKBUNQoHW6FvI4TsBElasr0bOufvJvaJ8lcrk=",
"ref": "refs/heads/main",
"rev": "11b7694a7e991862f980adbec8195969bf6d6e96",
"revCount": 2,
"type": "git",
"url": "https://git.asonix.dog/asonix/aarch64-linux-testing.git"
},
"original": {
"type": "git",
"url": "https://git.asonix.dog/asonix/aarch64-linux-testing.git"
}
},
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1673563280,
"narHash": "sha256-27+ZVRylsm7HwI3rUt6TFh3lrgzrvToJscL44fFd25Q=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e0c17a48c475a03775833892373777892a6b8ff6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1673569462, "lastModified": 1673569462,
"narHash": "sha256-iQUrbM/abkPzukU0GXwyb0ACBk1C9RH91Do0nL2/3jE=", "narHash": "sha256-iQUrbM/abkPzukU0GXwyb0ACBk1C9RH91Do0nL2/3jE=",
@ -18,7 +52,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "aarch64-linux-testing": "aarch64-linux-testing",
"nixpkgs": "nixpkgs_2"
} }
} }
}, },

View file

@ -1,11 +1,20 @@
{ {
description = "Build NixOS images for various ARM single computer boards"; description = "Build NixOS images for various ARM single computer boards";
# pin this to unstable # pin this to unstable
inputs.nixpkgs.url = "github:nixos/nixpkgs/master"; inputs = {
nixpkgs.url = "github:nixos/nixpkgs/master";
aarch64-linux-testing.url = "git+https://git.asonix.dog/asonix/aarch64-linux-testing.git";
};
outputs = { self, nixpkgs }: { outputs = { self, nixpkgs, aarch64-linux-testing }: {
packages.x86_64-linux = import ./. { packages.x86_64-linux = import ./. {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
aarch64-image =
let
base-path = aarch64-linux-testing.images.installer;
image-name = aarch64-linux-testing.nixosConfigurations.installer.config.sdImage.imageName;
in
"${base-path}/sd-image/${image-name}.zst";
}; };
}; };
} }

View file

@ -1,15 +1,8 @@
{ stdenv, fetchurl, zstd }: { stdenv, fetchurl, zstd, aarch64-image }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "aarch64-image"; name = "aarch64-image";
src = fetchurl { src = aarch64-image;
# unfortunally there is no easy way right now to reproduce the same evaluation
# as hydra, since `pkgs.path` is embedded in the binary
# To get a new url use:
# $ curl -s -L -I -o /dev/null -w '%{url_effective}' "https://hydra.nixos.org/job/nixos/release-20.03/nixos.sd_image.aarch64-linux/latest/download/1"
url = "https://hydra.nixos.org/build/148774499/download/1/nixos-sd-image-21.05.1817.2262d7863a6-aarch64-linux.img.zst";
sha256 = "sha256-ILKsbYoqh76CwUte7PF1VmE53wiZBsaEl412OSQ2HV4=";
};
preferLocalBuild = true; preferLocalBuild = true;
dontUnpack = true; dontUnpack = true;
dontBuild = true; dontBuild = true;
@ -26,6 +19,6 @@ stdenv.mkDerivation {
]; ];
installPhase = '' installPhase = ''
zstdcat $src > $out zstdcat "$src" > $out
''; '';
} }