A fork of attic a self-hostable Nix Binary Cache server
1{ lib, flake-parts-lib, inputs, self, ... }:
2let
3 inherit (lib)
4 mkOption
5 types
6 ;
7 inherit (flake-parts-lib)
8 mkPerSystemOption
9 ;
10in
11{
12 options = {
13 perSystem = mkPerSystemOption {
14 options.attic.integration-tests = {
15 nixpkgsArgs = mkOption {
16 type = types.attrsOf types.anything;
17 default = {};
18 };
19 tests = mkOption {
20 type = types.attrsOf types.package;
21 default = {};
22 };
23 stableTests = mkOption {
24 type = types.attrsOf types.package;
25 default = {};
26 };
27 };
28 };
29 };
30
31 config = {
32 flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
33 checks = {
34 inherit (self.checks) x86_64-linux;
35 };
36 };
37
38 perSystem = { self', pkgs, config, system, ... }: let
39 cfg = config.attic.integration-tests;
40
41 vmPkgs = import inputs.nixpkgs ({
42 inherit system;
43 overlays = [ self.overlays.default ];
44 } // cfg.nixpkgsArgs);
45 vmPkgsStable = import inputs.nixpkgs-stable ({
46 inherit system;
47 overlays = [ self.overlays.default ];
48 } // cfg.nixpkgsArgs);
49
50 makeIntegrationTests = pkgs: import ../integration-tests {
51 inherit pkgs;
52 flake = self;
53 };
54 in {
55 attic.integration-tests = {
56 tests = makeIntegrationTests vmPkgs;
57 stableTests = makeIntegrationTests vmPkgsStable;
58 };
59
60 checks = let
61 tests = cfg.tests;
62 stableTests = lib.mapAttrs' (name: lib.nameValuePair "stable-${name}") cfg.stableTests;
63 in lib.optionalAttrs pkgs.stdenv.isLinux (tests // stableTests);
64 };
65 };
66}