|
7 | 7 | # (Copyright (c) 2003-2022 Eelco Dolstra and the Nixpkgs/NixOS contributors, |
8 | 8 | # licensed under MIT License as well) |
9 | 9 |
|
10 | | -{ config, lib, pkgs, ... }: |
| 10 | +{ config, lib, pkgs, nixpkgs, ... }: |
11 | 11 |
|
12 | 12 | with lib; |
13 | 13 |
|
14 | 14 | let |
15 | 15 | cfg = config.nix; |
16 | 16 | renameNixOpt = old: new: |
17 | | - (mkRenamedOptionModule [ "nix" old ] [ "nix" new ]); |
| 17 | + mkRenamedOptionModuleWith { |
| 18 | + sinceRelease = 2205; |
| 19 | + from = [ "nix" old ]; |
| 20 | + to = [ "nix" "settings" new ]; |
| 21 | + }; |
18 | 22 | in |
19 | 23 |
|
20 | 24 | { |
21 | | - # Backward-compatibility with the NixOS options. |
22 | 25 | imports = [ |
23 | | - (renameNixOpt "binaryCaches" "substituters") |
24 | | - (renameNixOpt "binaryCachePublicKeys" "trustedPublicKeys") |
| 26 | + # Use options and config from upstream nix.nix |
| 27 | + "${nixpkgs}/nixos/modules/config/nix.nix" |
| 28 | + # Backward-compatibility with pre-`settings` options. |
| 29 | + (renameNixOpt "substituters" "substituters") |
| 30 | + (renameNixOpt "trustedPublicKeys" "trustedPublicKeys") |
25 | 31 | ]; |
26 | 32 |
|
27 | 33 | ###### interface |
|
51 | 57 | ''; |
52 | 58 | }; |
53 | 59 |
|
54 | | - ## From nix.nix |
55 | | - |
56 | | - substituters = mkOption { |
57 | | - type = types.listOf types.str; |
58 | | - default = [ ]; |
59 | | - description = '' |
60 | | - A list of URLs of substituters. The official NixOS and Nix-on-Droid |
61 | | - substituters are added by default. |
62 | | - ''; |
63 | | - }; |
64 | | - |
65 | | - trustedPublicKeys = mkOption { |
66 | | - type = types.listOf types.str; |
67 | | - default = [ ]; |
68 | | - description = '' |
69 | | - A list of public keys. When paths are copied from another Nix store (such as a |
70 | | - binary cache), they must be signed with one of these keys. The official NixOS |
71 | | - and Nix-on-Droid public keys are added by default. |
72 | | - ''; |
73 | | - }; |
74 | | - |
75 | | - extraOptions = mkOption { |
76 | | - type = types.lines; |
77 | | - default = ""; |
78 | | - description = "Extra config to be appended to <filename>/etc/nix/nix.conf</filename>."; |
79 | | - }; |
80 | 60 | }; |
81 | 61 |
|
82 | 62 | }; |
|
85 | 65 | ###### implementation |
86 | 66 |
|
87 | 67 | config = { |
88 | | - environment.etc = { |
89 | | - "nix/nix.conf".text = '' |
90 | | - sandbox = false |
91 | | - substituters = ${concatStringsSep " " cfg.substituters} |
92 | | - trusted-public-keys = ${concatStringsSep " " cfg.trustedPublicKeys} |
93 | | - ${cfg.extraOptions} |
94 | | - ''; |
95 | | - }; |
96 | | - |
97 | 68 | nix = { |
98 | 69 | enable = true; |
99 | | - substituters = [ |
| 70 | + settings.substituters = [ |
100 | 71 | "https://cache.nixos.org" |
101 | 72 | "https://nix-on-droid.cachix.org" |
102 | 73 | ]; |
103 | | - trustedPublicKeys = [ |
| 74 | + settings.trustedPublicKeys = [ |
104 | 75 | "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" |
105 | 76 | "nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU=" |
106 | 77 | ]; |
|
0 commit comments