Skip to content

Commit 1a7c132

Browse files
committed
feat(nix): Add cache and start cross-building VILLASnode for aarch64-linux
Signed-off-by: Steffen Vogel <[email protected]>
1 parent 1d56a5b commit 1a7c132

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

.gitlab-ci.yml

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,53 +89,41 @@ build:source:
8989

9090
build:nix:
9191
stage: build
92-
image: nixos/nix
92+
image: docker.nix-community.org/nixpkgs/cachix-flakes
9393
needs: []
94+
variables:
95+
CACHIX_CACHE_NAME: villas
96+
97+
parallel:
98+
matrix:
99+
- SYSTEM: [x86_64-linux, aarch64-linux]
94100

95101
artifacts:
96102
when: on_success
97103
access: all
98104
expire_in: "1 year"
99105
paths:
100-
- artifacts/villas
106+
- artifacts/*
101107

102108
before_script:
103-
- | # Create artifacts directory
104-
mkdir artifacts
105-
106-
- | # Configure Nix
107-
echo "experimental-features = flakes nix-command" >> /etc/nix/nix.conf
108-
109-
# - | # Configure Attic
110-
# nix shell nixpgks#attic-client
109+
- cachix use "$CACHIX_CACHE_NAME"
111110

112-
# attic login nulll https://cache.0l.de ${ATTIC_TOKEN}
113-
# attic use "nulll:villas"
111+
- | # Create directories
112+
mkdir -p artifacts /var/tmp/
114113
115-
script:
116-
- nix build --print-build-logs .
117-
118-
- | # Build ARX bundle
119-
nix bundle --out-link villas .
120-
cp -L villas artifacts/villas
121-
122-
- | # Build Docker image
114+
- | # Login at Docker registry
123115
nix run nixpkgs#skopeo -- login \
124116
--username ${CI_REGISTRY_USER} \
125117
--password ${CI_REGISTRY_PASSWORD} \
126118
${CI_REGISTRY}
127119
128-
nix build '.#dockerImage'
129-
130-
nix run nixpkgs#skopeo -- copy --insecure-policy \
131-
"docker-archive:./result" \
132-
"docker://${DOCKER_IMAGE}:${DOCKER_TAG}-nix"
133-
134-
# after_script:
135-
# - | # Push whole store to cache
136-
# nix shell nixpgks#attic-client
120+
script:
121+
- cachix watch-exec $CACHIX_CACHE_NAME -- nix build --print-build-logs ".#villas-node-${SYSTEM}"
122+
- cachix watch-exec $CACHIX_CACHE_NAME -- nix bundle --print-build-logs --out-link bundle ".#villas-node-${SYSTEM}"
123+
- cachix watch-exec $CACHIX_CACHE_NAME -- nix build --print-build-logs --out-link docker ".#dockerImage-${SYSTEM}"
137124

138-
# attic push /nix/store/*
125+
- cp -L bundle artifacts/villas-${SYSTEM}
126+
- nix run nixpkgs#skopeo -- --tmpdir=${TMPDIR} --insecure-policy copy "docker-archive:./docker" "docker://${DOCKER_IMAGE}:${DOCKER_TAG}-nix-${SYSTEM}"
139127

140128
# Stage: test
141129

flake.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
{
44
description = "VILLASnode is a client/server application to connect simulation equipment and software.";
55

6+
nixConfig = {
7+
extra-substituters = [
8+
"https://villas.cachix.org"
9+
];
10+
extra-trusted-public-keys = [
11+
"villas.cachix.org-1:vCWp9IzwxFT6ovZivQAvn5ZuLST01bpAGXWwlGTZ9fA="
12+
];
13+
};
14+
615
inputs = {
716
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
817
};

0 commit comments

Comments
 (0)