nix-community / infra

nix-community infrastructure [maintainer=@zowoq]
https://nix-community.org
MIT License
119 stars 81 forks source link

WIP blueprint #1563

Open zowoq opened 1 week ago

zowoq commented 1 week ago
zowoq commented 1 week ago

Autoloading host config, modules, devshells, packages is good but I think I'd rather just handle the checks manually. Some things doesn't need to be exposed except as a check and others I want exposed on all platforms but CI should only build one platform.


Minor nit, might be nice to hide these if they aren't used but maybe that is something better handled by flake schemas.

❯ nix flake show

homeModules: unknown
lib: unknown
modules: unknown
templates
zimbatm commented 1 week ago

Thanks for the feedback. For the checks, would it help if I added a checks/ folder that works like the packages/ folder? To restrict the checks to specific platforms, you can annotate them with the meta.platforms attibute.

zowoq commented 1 week ago

For the checks, would it help if I added a checks/ folder that works like the packages/ folder? To restrict the checks to specific platforms, you can annotate them with the meta.platforms attibute.

No, I realise that follows the existing pattern but checks folder and meta.platforms makes it more complicated than it needs to be.

This is fine, just need a way to do it.

checks =
  let
    darwinConfigurations = lib.mapAttrs' (
      name: config: lib.nameValuePair "host-${name}" config.config.system.build.toplevel
    ) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.darwinConfigurations);
    devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
    nixosConfigurations = lib.mapAttrs' (
      name: config: lib.nameValuePair "host-${name}" config.config.system.build.toplevel
    ) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
  in
  darwinConfigurations
  // devShells
  // {
    inherit (self') formatter;
  }
  // nixosConfigurations
  // pkgs.lib.optionalAttrs (system == "x86_64-linux") {
    inherit (self'.packages) docs docs-linkcheck;
    nixpkgs-update-supervisor-test = pkgs.callPackage ./hosts/build02/supervisor_test.nix { };
    nixosTests-buildbot = pkgs.nixosTests.buildbot;
    nixosTests-buildbot-nix-master = inputs'.buildbot-nix.checks.master;
    nixosTests-buildbot-nix-worker = inputs'.buildbot-nix.checks.worker;
    nixosTests-hydra = pkgs.nixosTests.hydra.hydra;
  };
zimbatm commented 1 week ago

So the part that's really custom is:

pkgs.lib.optionalAttrs (system == "x86_64-linux") {
    inherit (self'.packages) docs docs-linkcheck;
    nixpkgs-update-supervisor-test = pkgs.callPackage ./hosts/build02/supervisor_test.nix { };
    nixosTests-buildbot = pkgs.nixosTests.buildbot;
    nixosTests-buildbot-nix-master = inputs'.buildbot-nix.checks.master;
    nixosTests-buildbot-nix-worker = inputs'.buildbot-nix.checks.worker;
    nixosTests-hydra = pkgs.nixosTests.hydra.hydra;
  };

What if you could extend the checks more easily, and let the rest be managed by blueprint?

zowoq commented 1 week ago

What if you could extend the checks more easily, and let the rest be managed by blueprint?

Isn't this going to end up being basically same as what I was asking for as some of the default ones will need to be disabled?