-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfiguration.nix
148 lines (131 loc) · 3.51 KB
/
configuration.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
modulesPath,
lib,
pkgs,
...
}:
let
# CHANGEME: register a DNS domain, and make it point at IP of your fedimint server
# Typically you can use `ip ad ls | grep global` command on the server to find this value.
fqdn = "myfedimint.net";
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/profiles/qemu-guest.nix")
./disk-config.nix
];
boot.loader.grub = {
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
# devices = [ ];
efiSupport = true;
efiInstallAsRemovable = true;
};
services.openssh.enable = true;
environment.systemPackages = map lib.lowPrio [
pkgs.curl
pkgs.gitMinimal
pkgs.helix
pkgs.tmux
];
users.users.root.openssh.authorizedKeys.keys = [
# CHANGEME: put your ssh key here
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSUGPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XAt3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/EnmZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbxNrRFi9wrf+M7Q== [email protected]"
];
system.stateVersion = "24.04";
networking.enableIPv6 = true;
security.acme = {
# CHANGEME: email address you would like to use to get notifications about
# SSL domain issues etc.
defaults.email = "[email protected]";
acceptTerms = true;
};
networking = {
firewall = {
allowPing = true;
allowedTCPPorts = [
80
443
];
};
};
# General server stuff
boot.tmp.cleanOnBoot = true;
services.automatic-timezoned.enable = true;
nix = {
extraOptions = ''
experimental-features = nix-command flakes repl-flake
'';
settings = {
max-jobs = "auto";
auto-optimise-store = true;
};
daemonIOSchedClass = "idle";
daemonIOSchedPriority = 7;
daemonCPUSchedPolicy = "idle";
gc = {
automatic = true;
persistent = true;
dates = "monthly";
options = "--delete-older-than 30d";
};
settings = {
keep-derivations = lib.mkForce false;
keep-outputs = lib.mkForce false;
};
};
services.journald.extraConfig = "SystemMaxUse=1G";
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
nix-bitcoin = {
generateSecrets = true;
operator = {
enable = true;
name = "operator";
};
};
services.bitcoind = {
enable = true;
prune = 550;
dbCache = 2200;
extraConfig = ''
# minimum memory usage settings, even on mainnet it will be slow but will work just fine
maxmempool=5
par=2
rpcthreads=4
maxconnections=32
'';
};
# give fedimintd user access to the bitcoind secret
systemd.services.fedimintd-mainnet.serviceConfig = {
SupplementaryGroups = "bitcoinrpc-public";
};
services.fedimintd."mainnet" = {
enable = true;
environment = {
"RUST_LOG" = "info";
"RUST_BACKTRACE" = "1";
"FM_REL_NOTES_ACK" = "0_4_xyz";
};
api = {
url = "wss://${fqdn}/ws/";
};
p2p = {
url = "fedimint://${fqdn}:8173";
};
bitcoin = {
network = "bitcoin";
rpc = {
url = "http://[email protected]:8332";
secretFile = "/etc/nix-bitcoin-secrets/bitcoin-rpcpassword-public";
};
};
nginx = {
enable = true;
inherit fqdn;
};
};
}