Set nixpkgs cache TTL duration

This commit is contained in:
Qingsong Chen 2025-07-17 09:40:41 +00:00 committed by Tate, Hongliang Tian
parent 54b1782a2f
commit 12c40de5a9
2 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,9 @@ SMP ?= 1
SYSCALL_TEST_SUITE ?= ltp
SYSCALL_TEST_WORKDIR ?= /tmp
ENABLE_BASIC_TEST ?= false
# Set Nix's cached tarballs to be live for a longer period of time (30 days) to avoid network traffics.
# Nix's default value is rather small (1 hour or 3600 seconds).
NIXPKGS_CACHE_TTL := 2592000 # In seconds
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
BUILD_DIR := $(CUR_DIR)/build
@ -43,6 +46,7 @@ build: $(INITRAMFS_IMAGE) $(EXT2_IMAGE) $(EXFAT_IMAGE)
.PHONY: $(INITRAMFS_IMAGE)
$(INITRAMFS_IMAGE): $(INITRAMFS)
@nix-build \
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
--argstr target $(ARCH) \
--arg enableBasicTest $(ENABLE_BASIC_TEST) \
--arg enableBenchmark $(ENABLE_BENCHMARK) \
@ -57,6 +61,7 @@ $(INITRAMFS_IMAGE): $(INITRAMFS)
.PHONY: $(INITRAMFS)
$(INITRAMFS):
@nix-build \
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
--argstr target $(ARCH) \
--arg enableBasicTest $(ENABLE_BASIC_TEST) \
--arg enableBenchmark $(ENABLE_BENCHMARK) \

View File

@ -10,8 +10,11 @@ let
throw "Target arch ${target} not yet supported.";
# Pinned nixpkgs (nix version: 2.29.1, channel: nixos-25.05, release date: 2025-07-01)
nixpkgs = fetchTarball
"https://github.com/NixOS/nixpkgs/archive/c0bebd16e69e631ac6e52d6eb439daba28ac50cd.tar.gz";
nixpkgs = fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/c0bebd16e69e631ac6e52d6eb439daba28ac50cd.tar.gz";
sha256 = "1fbhkqm8cnsxszw4d4g0402vwsi75yazxkpfx3rdvln4n6s68saf";
};
pkgs = import nixpkgs {
config = { };
overlays = [ ];