From 197463cc08da1b2f048f8b493d7d96efb62d2a41 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Wed, 28 May 2025 14:44:07 +0200 Subject: [PATCH] Test `push-to-cache` script --- .forgejo/workflows/build.yaml | 4 +++- checks/default.nix | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index a2224c0..6edae8f 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -16,6 +16,8 @@ jobs: chmod 600 ~/.ssh/id_ed25519 ssh-keyscan github.com >> ~/.ssh/known_hosts - name: Build with nix (x86_64-linux) - run: nix-fast-build --no-nom --systems "x86_64-linux aarch64-linux" --attic-cache "nixfleet" --skip-cached --result-file result.json || true + run: nix-fast-build --no-nom --systems "x86_64-linux aarch64-linux" --skip-cached --result-file result.json || true + - name: Push to cache + run: nix run .#push-to-cache -- nixfleet - name: Report checks run: report-checks diff --git a/checks/default.nix b/checks/default.nix index ae2c491..9030d41 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -11,7 +11,7 @@ ]; perSystem = - { config, ... }: + { config, pkgs, ... }: { treefmt.config = { projectRootFile = ".git/config"; @@ -42,6 +42,18 @@ package = config.treefmt.build.wrapper; }; }; + packages.push-to-cache = + let + allChecks = with self.checks; x86_64-linux // aarch64-linux; + checks = builtins.removeAttrs allChecks [ "push-to-cache" ]; + in + pkgs.writeShellScriptBin "push-to-cache.sh" '' + attic push $1 --stdin --jobs 64 << EOF + ${lib.concatStringsSep "\n" ( + builtins.map (builtins.unsafeDiscardStringContext) (builtins.attrValues checks) + )} + EOF + ''; }; flake.checks = @@ -49,7 +61,9 @@ build = _: nc: nc.config.system.build.toplevel; in { - x86_64-linux = lib.mapAttrs build { inherit (self.nixosConfigurations) picard pike kirk; }; + x86_64-linux = (lib.mapAttrs build { inherit (self.nixosConfigurations) picard pike kirk; }) // { + inherit (self.checks.x86_64-linux) push-to-cache; + }; aarch64-linux = lib.mapAttrs build { inherit (self.nixosConfigurations) sisko; # pbp; };