Skip to content

Commit 0f78892

Browse files
committed
nix.nix: inherit from upstream nix.nix
1 parent 5828992 commit 0f78892

File tree

1 file changed

+13
-42
lines changed

1 file changed

+13
-42
lines changed

modules/environment/nix.nix

+13-42
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,27 @@
77
# (Copyright (c) 2003-2022 Eelco Dolstra and the Nixpkgs/NixOS contributors,
88
# licensed under MIT License as well)
99

10-
{ config, lib, pkgs, ... }:
10+
{ config, lib, pkgs, nixpkgs, ... }:
1111

1212
with lib;
1313

1414
let
1515
cfg = config.nix;
1616
renameNixOpt = old: new:
17-
(mkRenamedOptionModule [ "nix" old ] [ "nix" new ]);
17+
mkRenamedOptionModuleWith {
18+
sinceRelease = 2205;
19+
from = [ "nix" old ];
20+
to = [ "nix" "settings" new ];
21+
};
1822
in
1923

2024
{
21-
# Backward-compatibility with the NixOS options.
2225
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" "trusted-public-keys")
2531
];
2632

2733
###### interface
@@ -51,32 +57,6 @@ in
5157
'';
5258
};
5359

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-
};
8060
};
8161

8262
};
@@ -85,22 +65,13 @@ in
8565
###### implementation
8666

8767
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-
9768
nix = {
9869
enable = true;
99-
substituters = [
70+
settings.substituters = [
10071
"https://cache.nixos.org"
10172
"https://nix-on-droid.cachix.org"
10273
];
103-
trustedPublicKeys = [
74+
settings.trusted-public-keys = [
10475
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
10576
"nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU="
10677
];

0 commit comments

Comments
 (0)