1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

Update nix.registry definition to match NixOS module

This commit is contained in:
Malo Bourgon 2022-08-13 16:51:25 -07:00
parent 7648c9befc
commit f88286eda0

View file

@ -346,26 +346,32 @@ in
registry = mkOption { registry = mkOption {
type = types.attrsOf (types.submodule ( type = types.attrsOf (types.submodule (
let let
inputAttrs = types.attrsOf (types.oneOf [types.str types.int types.bool types.package]); referenceAttrs = with types; attrsOf (oneOf [
str
int
bool
package
]);
in in
{ config, name, ... }: { config, name, ... }:
{ options = { {
options = {
from = mkOption { from = mkOption {
type = inputAttrs; type = referenceAttrs;
example = { type = "indirect"; id = "nixpkgs"; }; example = { type = "indirect"; id = "nixpkgs"; };
description = "The flake reference to be rewritten."; description = "The flake reference to be rewritten.";
}; };
to = mkOption { to = mkOption {
type = inputAttrs; type = referenceAttrs;
example = { type = "github"; owner = "my-org"; repo = "my-nixpkgs"; }; example = { type = "github"; owner = "my-org"; repo = "my-nixpkgs"; };
description = "The flake reference to which <option>from></option> is to be rewritten."; description = "The flake reference <option>from</option> is rewritten to.";
}; };
flake = mkOption { flake = mkOption {
type = types.unspecified; type = types.nullOr types.attrs;
default = null; default = null;
example = literalExpression "nixpkgs"; example = literalExpression "nixpkgs";
description = '' description = ''
The flake input to which <option>from></option> is to be rewritten. The flake input <option>from</option> is rewritten to.
''; '';
}; };
exact = mkOption { exact = mkOption {
@ -380,16 +386,17 @@ in
}; };
config = { config = {
from = mkDefault { type = "indirect"; id = name; }; from = mkDefault { type = "indirect"; id = name; };
to = mkIf (config.flake != null) to = mkIf (config.flake != null) (mkDefault
({ type = "path"; {
path = config.flake.outPath; type = "path";
} // lib.filterAttrs path = config.flake.outPath;
(n: v: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash") } // filterAttrs
config.flake); (n: _: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash")
config.flake);
}; };
} }
)); ));
default = {}; default = { };
description = '' description = ''
A system-wide flake registry. A system-wide flake registry.
''; '';