{ description = "A simple base flake to be used as a starting point to avoid setting up everything for every flake"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; snowfall-lib = { url = "github:snowfallorg/lib"; inputs.nixpkgs.follows = "nixpkgs"; }; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; }; outputs = { self, nixpkgs, snowfall-lib, treefmt-nix, }: let eachSystemOp = op: systems: f: builtins.foldl' (op f) { } systems; in { lib.eachSystem = eachSystemOp ( f: attrs: system: let result = f system; in builtins.foldl' ( attrs: key: attrs // { ${key} = (attrs.${key} or { }) // { ${system} = result.${key}; }; } ) attrs (builtins.attrNames result) ); lib.mkFlake = options@{ flakeBaseSystems ? [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ], treeFmtFile ? ./treefmt.nix, ... }: let snowfallOptions = builtins.removeAttrs options [ "flakeBaseSystems" "treeFmtFile" ]; flake = snowfall-lib.mkFlake snowfallOptions; in flake // (self.lib.eachSystem flakeBaseSystems ( system: let pkgs = import nixpkgs { inherit system; }; treeFmtEval = treefmt-nix.lib.evalModule pkgs treeFmtFile; in { formatter = flake.formatter.${system} or treeFmtEval.config.build.wrapper; checks = flake.checks.${system} // { fmt = treeFmtEval.config.build.check self; }; } )); }; }