@@ -89,53 +89,41 @@ build:source:
8989
9090build: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
0 commit comments