-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnix.nix
110 lines (92 loc) · 3.01 KB
/
nix.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{ config, pkgs, lib, self, ... }:
let
cfg = config.gradient;
in
{
options = {
gradient.core.nix.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.core.enable;
description = ''
Whether to enable Nix-specific core GradientOS configurations.
'';
};
gradient.core.nix.emptyGlobalFlakeRegistry = lib.mkOption {
type = lib.types.bool;
default = cfg.core.nix.enable;
description = ''
Whether to empty the global flake registry.
'';
};
gradient.core.nix.pinChannelsToFlakeInputs = lib.mkOption {
type = lib.types.bool;
default = cfg.core.nix.enable;
description = ''
Whether to enable pinning channels to various GradientOS flake inputs, such as nixpgks.
'';
};
};
config = lib.mkMerge [
(lib.mkIf cfg.core.nix.enable {
nix =
{
settings = {
cores = 0;
max-jobs = "auto";
experimental-features = [ "nix-command" "flakes" ];
keep-outputs = true;
keep-derivations = true;
substituters = [
"https://nix-gaming.cachix.org?priority=10"
"https://nix-community.cachix.org?priority=20"
"https://cache.lix.systems?priority=20"
];
trusted-public-keys = with cfg.const.nix.pubKeys; [
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
asiyah
briah
bernkastel
beatrice
erika
neith-deck
];
trusted-users = [
"root"
"@wheel"
];
};
extraOptions = ''
fallback = true
connect-timeout = 2
'';
gc = {
automatic = true;
persistent = true;
dates = "15:00";
options = "--delete-older-than 7d";
};
optimise = {
automatic = true;
dates = [ "weekly" ];
};
};
})
(lib.mkIf cfg.core.nix.emptyGlobalFlakeRegistry {
nix.settings.flake-registry = builtins.toFile "empty-registry.json" ''{"flakes": [], "version": 2}'';
})
(lib.mkIf cfg.core.nix.pinChannelsToFlakeInputs {
# Pin channels to flake inputs.
nix.registry.nixpkgs.flake = self.inputs.nixpkgs;
nix.registry.nixpkgs-master.flake = self.inputs.nixpkgs-master;
nix.registry.nixpkgs-stable.flake = self.inputs.nixpkgs-stable;
nix.registry.self.flake = self;
environment.etc."nix/inputs/nixpkgs".source = "${self.inputs.nixpkgs}";
environment.etc."nix/inputs/nixpkgs-master".source = "${self.inputs.nixpkgs-master}";
environment.etc."nix/inputs/nixpkgs-stable".source = "${self.inputs.nixpkgs-stable}";
environment.etc."nix/inputs/self".source = "${self}";
nix.nixPath = [ "/etc/nix/inputs" ];
})
];
}