Skip to content

Commit

Permalink
Speedup static build by utilizing CI cache on /nix folder
Browse files Browse the repository at this point in the history
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
  • Loading branch information
hswong3i committed Aug 22, 2020
1 parent 7ab6aa1 commit e3a7258
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
20 changes: 17 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,33 @@ static_binary_task:
depends_on:
- 'config'
- 'fmt'

gce_instance:
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
cpu: 8
memory: 12
disk: 200
script: |

init_script: |
set -ex
setenforce 0
growpart /dev/sda 1 || true
resize2fs /dev/sda1 || true
yum -y install podman
mkdir -p /nix
podman run --rm --privileged -ti -v /:/mnt nixos/nix cp -rfT /nix /mnt/nix
nix_cache:
folder: '.cache'
fingerprint_script: |
echo "nix-v1-$(sha1sum nix/nixpkgs.json | head -c 40)"
build_script: |
set -ex
mkdir -p .cache
mv .cache /nix
if [[ -z $(ls -A /nix) ]]; then podman run --rm --privileged -ti -v /:/mnt nixos/nix cp -rfT /nix /mnt/nix; fi
podman run --rm --privileged -ti -v /nix:/nix -v ${PWD}:${PWD} -w ${PWD} nixos/nix nix --print-build-logs --option cores 8 --option max-jobs 8 build --file nix/
mv /nix .cache
chown -Rf $(whoami) .cache
binaries_artifacts:
path: "result/bin/conmon"
1 change: 1 addition & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let
config = {
packageOverrides = pkg: {
autogen = (static pkg.autogen);
e2fsprogs = (static pkg.e2fsprogs);
glib = (static pkg.glib).overrideAttrs(x: {
outputs = [ "bin" "out" "dev" ];
mesonFlags = [
Expand Down
6 changes: 3 additions & 3 deletions nix/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"url": "https://github.com/nixos/nixpkgs",
"rev": "02591d02a910b3b92092153c5f3419a8d696aa1d",
"date": "2020-07-09T03:52:28+02:00",
"sha256": "1pp9v4rqmgx1b298gxix8b79m8pvxy1rcf8l25rxxxxnkr5ls1ng",
"rev": "5f212d693fe1c82f9c7e20cd57bc69802b36a321",
"date": "2020-08-22T01:42:23+02:00",
"sha256": "1h3819ppllcpw07j884bjh07sma07vrrk1md92sf93cg43nmzncf",
"fetchSubmodules": false
}

0 comments on commit e3a7258

Please sign in to comment.