diff --git a/flake.nix b/flake.nix index 5ca5ab7..c9ab89e 100644 --- a/flake.nix +++ b/flake.nix @@ -8,8 +8,17 @@ let forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" - "aarch64-linux" ]; + # Discover child flake directories automatically + childFlakeDirs = + let + entries = builtins.readDir ./.; + in + builtins.filter ( + name: + entries.${name} == "directory" + && builtins.pathExists (./. + "/${name}/flake.nix") + ) (builtins.attrNames entries); in { packages = forAllSystems ( @@ -37,5 +46,27 @@ program = "${self.packages.${system}.update}/bin/update-pins"; }; }); + + checks = forAllSystems ( + system: + builtins.listToAttrs ( + map ( + name: + let + lock = builtins.fromJSON (builtins.readFile (./. + "/${name}/flake.lock")); + nixpkgsNode = lock.nodes.${lock.nodes.root.inputs.nixpkgs}; + nixpkgsSrc = builtins.fetchTarball { + url = "https://github.com/${nixpkgsNode.locked.owner}/${nixpkgsNode.locked.repo}/archive/${nixpkgsNode.locked.rev}.tar.gz"; + sha256 = nixpkgsNode.locked.narHash; + }; + pkgs = import nixpkgsSrc { inherit system; }; + in + { + inherit name; + value = pkgs.matrix-synapse; + } + ) childFlakeDirs + ) + ); }; }