diff --git a/flake.nix b/flake.nix index 09a84066..93c97d7a 100644 --- a/flake.nix +++ b/flake.nix @@ -129,6 +129,7 @@ outputs = inputs @ {flake-parts, ...}: flake-parts.lib.mkFlake {inherit inputs;} { imports = [ + ./flake/buildkite-pipeline.nix ./flake/devenv.nix ./flake/github-actions.nix ./flake/helper-packages.nix @@ -139,4 +140,4 @@ ]; systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; }; -} \ No newline at end of file +} diff --git a/flake/buildkite-pipeline.nix b/flake/buildkite-pipeline.nix new file mode 100644 index 00000000..9dfc5bb5 --- /dev/null +++ b/flake/buildkite-pipeline.nix @@ -0,0 +1,58 @@ +{ + withSystem, + lib, + self, + ... +}: let + inherit (lib) mapAttrsToList filterAttrs hasPrefix filter elem; + defaultSkip = [ + "container-" + "container-processes" + "container-shell" + "devenv-up" + ]; + matrix = withSystem "x86_64-linux" ( + ctx @ {pkgs, ...}: let + skip = + (mapAttrsToList (name: _: name) (filterAttrs (name: _: hasPrefix "images/" name) pkgs)) + ++ defaultSkip; + in + filter (item: !(elem item skip)) (mapAttrsToList (name: _: name) ctx.config.packages) + ); +in { + flake = { + buildkite-pipeline = { + env = { + CACHE_NAME = "insane"; + NIX_CONFIG = "accept-flake-config = true"; + }; + steps = [ + { + group = ":broom: Linting and syntax checks"; + key = "checks"; + steps = [ + { + label = ":nix: Lint"; + command = "nix run .#world -- lint"; + } + { + label = ":nix: Check"; + command = "nix run .#world -- check"; + } + ]; + } + { + group = ":hammer_and_pick: Building packages"; + key = "packages"; + steps = [ + { + label = ":nix: {{matrix}} build"; + command = "nix build .#packages.x86_64-linux.{{matrix}} -L"; + inherit matrix; + } + ]; + } + ]; + }; + }; +} diff --git a/flake/packages.nix b/flake/packages.nix index 084e711c..1f160fc5 100644 --- a/flake/packages.nix +++ b/flake/packages.nix @@ -70,7 +70,7 @@ in pkgs.writeShellApplication { name = "world"; - runtimeInputs = with pkgs; [just nushell statix deadnix]; + runtimeInputs = with pkgs; [just nushell statix deadnix cachix]; text = '' just -f ${pkgs.replaceVars ../files/Justfile.template { inherit upgrade build;