{ description = "Pinned matrix package versions"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; outputs = { self, nixpkgs, ... }: let forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-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 ( system: let pkgs = nixpkgs.legacyPackages.${system}; in { update = pkgs.writeShellApplication { name = "update-pins"; runtimeInputs = [ pkgs.git pkgs.nix pkgs.jq pkgs.coreutils ]; text = builtins.readFile ./update.sh; }; } ); apps = forAllSystems (system: { update = { type = "app"; 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 ) ); }; }