From c8a26d63de6c45d406b172bfe5324dc4ce5c0738 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sun, 12 May 2024 16:35:14 +0100 Subject: [PATCH] ci: prebuild and push to cache --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ flake.nix | 9 +++++++++ 2 files changed, 38 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94a9434..79915b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,8 +2,37 @@ # only a deploy stage stages: + - build - deploy +.scripts_base: &scripts_base + - nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#bash + +.scripts_cache: &scripts_cache + - nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#attic-client + - attic login skynet https://nix-cache.skynet.ie/ $CACHE_KEY + - attic use skynet-cache + +build: + tags: + - nix + before_script: + - *scripts_base + - *scripts_cache + stage: build + + # when it runs + rules: + - if: '$CI_PROJECT_NAMESPACE == "compsoc1/compsoc" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + changes: + - src/**/* + + # what it runs + script: + # cache any dependencies + - attic watch-store skynet-cache & + - nix --extra-experimental-features 'nix-command flakes' build + nixos: stage: deploy diff --git a/flake.nix b/flake.nix index df433f6..f5c9e66 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,15 @@ bfom.url = "gitlab:silver_rust/bfom"; }; + /* + sudo nano /etc/nix/nix.conf + trusted-users = {username} + */ + nixConfig = { + extra-substituters = "https://nix-cache.skynet.ie/skynet-cache"; + extra-trusted-public-keys = "skynet-cache:OdfA4Or0JcHiHf05fsiIR4nZT2z2yDEtkoLqhntGAz4="; + }; + outputs = { self, nixpkgs, bfom, ... } @inputs: let pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;