@ -376,6 +376,59 @@ in
If enabled ( the default ) , checks that Nix can parse the generated nix . conf .
'' ;
} ;
registry = mkOption {
type = types . attrsOf ( types . submodule (
let
inputAttrs = types . attrsOf ( types . oneOf [ types . str types . int types . bool types . package ] ) ;
in
{ config , name , . . . }:
{ options = {
from = mkOption {
type = inputAttrs ;
example = { type = " i n d i r e c t " ; id = " n i x p k g s " ; } ;
description = " T h e f l a k e r e f e r e n c e t o b e r e w r i t t e n . " ;
} ;
to = mkOption {
type = inputAttrs ;
example = { type = " g i t h u b " ; owner = " m y - o r g " ; repo = " m y - n i x p k g s " ; } ;
description = " T h e f l a k e r e f e r e n c e t o w h i c h < o p t i o n > f r o m > < / o p t i o n > i s t o b e r e w r i t t e n . " ;
} ;
flake = mkOption {
type = types . unspecified ;
default = null ;
example = literalExample " n i x p k g s " ;
description = ''
The flake input to which <option> from > < /option > is to be rewritten .
'' ;
} ;
exact = mkOption {
type = types . bool ;
default = true ;
description = ''
Whether the <option> from < /option > reference needs to match exactly . If set ,
a <option> from < /option > reference like <literal> nixpkgs < /literal > does not
match with a reference like <literal> nixpkgs/nixos-20.03 < /literal > .
'' ;
} ;
} ;
config = {
from = mkDefault { type = " i n d i r e c t " ; id = name ; } ;
to = mkIf ( config . flake != null )
( { type = " p a t h " ;
path = config . flake . outPath ;
} // lib . filterAttrs
( n : v : n == " l a s t M o d i f i e d " || n == " r e v " || n == " r e v C o u n t " || n == " n a r H a s h " )
config . flake ) ;
} ;
}
) ) ;
default = { } ;
description = ''
A system-wide flake registry .
'' ;
} ;
} ;
} ;
@ -390,6 +443,11 @@ in
environment . etc . " n i x / n i x . c o n f " . source = nixConf ;
environment . etc . " n i x / r e g i s t r y . j s o n " . text = builtins . toJSON {
version = 2 ;
flakes = mapAttrsToList ( n : v : { inherit ( v ) from to exact ; } ) cfg . registry ;
} ;
# List of machines for distributed Nix builds in the format
# expected by build-remote.pl.
environment . etc . " n i x / m a c h i n e s " =