From 9a30b2769bf42e6e991be887ae735ec8fc192455 Mon Sep 17 00:00:00 2001 From: asonix Date: Thu, 12 Jan 2023 19:11:53 -0600 Subject: [PATCH] Update to use custom base image --- default.nix | 3 ++- flake.lock | 37 +++++++++++++++++++++++++++++++++- flake.nix | 13 ++++++++++-- pkgs/aarch64-image/default.nix | 13 +++--------- 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/default.nix b/default.nix index 3df4ede..1b70f92 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,5 @@ { pkgs ? import { } +, aarch64-image }: let @@ -7,7 +8,7 @@ let }; 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 { inherit uboot; inherit aarch64Image buildImage; diff --git a/flake.lock b/flake.lock index a38b77a..feef9cd 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,40 @@ { "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": { + "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": { "lastModified": 1673569462, "narHash": "sha256-iQUrbM/abkPzukU0GXwyb0ACBk1C9RH91Do0nL2/3jE=", @@ -18,7 +52,8 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "aarch64-linux-testing": "aarch64-linux-testing", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index c4676b6..a248cfc 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,20 @@ { description = "Build NixOS images for various ARM single computer boards"; # 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 ./. { 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"; }; }; } diff --git a/pkgs/aarch64-image/default.nix b/pkgs/aarch64-image/default.nix index 88d0455..d9f1f0c 100644 --- a/pkgs/aarch64-image/default.nix +++ b/pkgs/aarch64-image/default.nix @@ -1,15 +1,8 @@ -{ stdenv, fetchurl, zstd }: +{ stdenv, fetchurl, zstd, aarch64-image }: stdenv.mkDerivation { name = "aarch64-image"; - src = fetchurl { - # 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="; - }; + src = aarch64-image; preferLocalBuild = true; dontUnpack = true; dontBuild = true; @@ -26,6 +19,6 @@ stdenv.mkDerivation { ]; installPhase = '' - zstdcat $src > $out + zstdcat "$src" > $out ''; }