2 Manages the flake registry.
27 type = types.attrsOf (types.submodule (
29 referenceAttrs = with types; attrsOf (oneOf [
37 { config, name, ... }:
41 type = referenceAttrs;
42 example = { type = "indirect"; id = "nixpkgs"; };
43 description = "The flake reference to be rewritten.";
46 type = referenceAttrs;
47 example = { type = "github"; owner = "my-org"; repo = "my-nixpkgs"; };
48 description = "The flake reference {option}`from` is rewritten to.";
51 type = types.nullOr types.attrs;
53 example = literalExpression "nixpkgs";
55 The flake input {option}`from` is rewritten to.
62 Whether the {option}`from` reference needs to match exactly. If set,
63 a {option}`from` reference like `nixpkgs` does not
64 match with a reference like `nixpkgs/nixos-20.03`.
69 from = mkDefault { type = "indirect"; id = name; };
70 to = mkIf (config.flake != null) (mkDefault (
73 path = config.flake.outPath;
75 (n: _: n == "lastModified" || n == "rev" || n == "narHash")
83 A system-wide flake registry.
89 config = mkIf cfg.enable {
90 environment.etc."nix/registry.json".text = builtins.toJSON {
92 flakes = mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry;