From 1fd44269a2d7a0f2d9036230506a7e8b5b80e120 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 11 Dec 2024 12:05:16 -0500 Subject: [PATCH] feat(checks): make #nixFastChecks an attrset --- checks/apps/default.nix | 2 +- checks/default.nix | 12 ++++++++++-- checks/devices/default.nix | 15 ++++++++++++--- checks/packages/default.nix | 4 +++- devices/servivi/modules/binary-cache.nix | 7 +++---- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/checks/apps/default.nix b/checks/apps/default.nix index a74c56b1..b4726df0 100644 --- a/checks/apps/default.nix +++ b/checks/apps/default.nix @@ -6,5 +6,5 @@ in mapAttrs' (name: app: - nameValuePair "app-${name}" app) + nameValuePair "app_${name}" app) self.appsPackages.${pkgs.system} diff --git a/checks/default.nix b/checks/default.nix index 44a43817..93b84788 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -5,5 +5,13 @@ apps = import ./apps {inherit pkgs self;}; devices = import ./devices {inherit pkgs self;}; packages = import ./packages {inherit pkgs self;}; -in - apps // devices // packages +in { + # Allow homie to serve a binary cache for the devices away from servivi + aptDevices = import ./devices { + onlyApt = true; + inherit pkgs self; + }; + + all = apps // devices // packages; + inherit apps packages devices; +} diff --git a/checks/devices/default.nix b/checks/devices/default.nix index 9211400b..ec8cd4e5 100644 --- a/checks/devices/default.nix +++ b/checks/devices/default.nix @@ -2,9 +2,18 @@ { pkgs, self, + onlyApt ? false, }: let - inherit (pkgs.lib) filterAttrs mapAttrs' nameValuePair; + inherit (pkgs.lib) elem filterAttrs mapAttrs' nameValuePair; + + devices = filterAttrs (n: config: let + isSameSystem = config.pkgs.system == pkgs.system; + in + if onlyApt + then isSameSystem && elem n ["bbsteamie" "binto" "homie" "wim"] + else isSameSystem) + self.nixosConfigurations; in mapAttrs' - (name: config: nameValuePair "nixos-${name}" config.config.system.build.toplevel) - ((filterAttrs (_: config: config.pkgs.system == pkgs.system)) self.nixosConfigurations) + (name: config: nameValuePair "device_${name}" config.config.system.build.toplevel) + devices diff --git a/checks/packages/default.nix b/checks/packages/default.nix index 42d48a67..2730edca 100644 --- a/checks/packages/default.nix +++ b/checks/packages/default.nix @@ -2,7 +2,7 @@ pkgs, self, }: let - inherit (pkgs.lib) elem filterAttrs hasAttr; + inherit (pkgs.lib) elem filterAttrs hasAttr mapAttrs' nameValuePair; packages = filterAttrs ( @@ -12,4 +12,6 @@ ) self.packages.${pkgs.system}; in + mapAttrs' + (name: pkg: nameValuePair "pkg_${name}" pkg) packages diff --git a/devices/servivi/modules/binary-cache.nix b/devices/servivi/modules/binary-cache.nix index 1e744369..924679f3 100644 --- a/devices/servivi/modules/binary-cache.nix +++ b/devices/servivi/modules/binary-cache.nix @@ -4,8 +4,7 @@ pkgs, ... }: let - # FIXME: make #nixFastChecks an attrset of all, packages, devices and aptDevices - # add binary cache at apartment + # FIXME: add binary cache at apartment inherit (builtins) attrValues; inherit (config.sops) secrets; @@ -28,7 +27,7 @@ nom build --no-link \ ..#nixosConfigurations.homie.config.services.home-assistant.package - nix-fast-build -f ..#nixFastChecks "$@" + nix-fast-build -f ..#nixFastChecks.${pkgs.system}.all "$@" ''; }; in { @@ -70,7 +69,7 @@ in { git clone https://git.nelim.org/matt1432/nixos-configs.git nix-clone cd nix-clone - nix-fast-build -f .#nixFastChecks + nix-fast-build -f .#nixFastChecks.${pkgs.system}.all cd .. rm -r nix-clone