-
Notifications
You must be signed in to change notification settings - Fork 0
/
supermicro.nix
200 lines (172 loc) · 4.61 KB
/
supermicro.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
{ config, pkgs, lib, ... }:
{
imports = [
./supermicro-hardware.nix
./nixos/kernel.nix
./nixos/nix.nix
./nixos/security.nix
./nixos/ssh.nix
./nixos/users.nix
./nixos/zfs.nix
];
boot = {
kernelModules = [ "coretemp" ];
kernelParams = [ "libata.force=noncq" ];
loader = {
grub = {
device = "/dev/disk/by-id/usb-SABRENT_SABRENT_DB9876543214E-0:0";
enable = true;
};
};
tmp.cleanOnBoot = true;
zfs = {
forceImportAll = lib.mkForce false;
forceImportRoot = false;
requestEncryptionCredentials = lib.mkForce false;
};
};
console.keyMap = "us";
documentation.nixos.enable = false;
environment = {
etc."sysconfig/lm_sensors".text = ''
HWMON_MODULES="coretemp"
'';
systemPackages = with pkgs; [ ];
};
hardware.cpu.intel.updateMicrocode = true;
hardware.enableAllFirmware = true;
i18n = { defaultLocale = "en_US.UTF-8"; };
networking = {
defaultGateway = "10.0.0.2";
firewall = {
allowPing = true;
allowedTCPPorts = [
111
139
445
2049
4000
4001
4002
20048
config.services.prometheus.exporters.node.port
config.services.prometheus.exporters.zfs.port
];
allowedUDPPorts = [
111
149
445
2049
4000
4001
4002
20048
config.services.prometheus.exporters.node.port
config.services.prometheus.exporters.zfs.port
];
enable = true;
extraCommands = ''
iptables -A INPUT -p tcp -s 10.0.0.0/8 --dport 548 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
'';
};
hostName = "supermicro";
hostId = "123b567b";
};
powerManagement = {
cpuFreqGovernor = "powersave";
powertop.enable = true;
};
services = {
cron = {
enable = true;
systemCronJobs = [
"0 17 * * 0 root reboot"
"0 18 * * * root ${pkgs.google-cloud-sdk}/bin/gsutil -m rsync -c -r /nfs/pictures gs://nequi-nas-p/"
];
};
nfs.server = {
enable = true;
exports = ''
/nfs 10.0.10.5(rw,fsid=0,no_subtree_check,insecure)
/nfs/pictures 10.0.10.5(rw,nohide,no_subtree_check,insecure,sync,all_squash,anonuid=1000,anongid=100)
'';
lockdPort = 4001;
mountdPort = 4002;
statdPort = 4000;
};
ntp = {
enable = true;
servers = [
"0.ca.pool.ntp.org"
"1.ca.pool.ntp.org"
"2.ca.pool.ntp.org"
"3.ca.pool.ntp.org"
];
};
thermald.enable = true;
openssh.enable = true;
samba = {
enable = true;
openFirewall = true;
securityType = "user";
extraConfig = ''
# workgroup = WORKGROUP
server string = smbnix
netbios name = smbnix
security = user
hosts allow = 10.0.10.5 10.0.10.6 127.0.0.1 localhost
hosts deny = 0.0.0.0/0
guest account = nobody
map to guest = bad user
unix password sync = yes
ea support = yes
fruit:metadata = stream
fruit:model = MacSamba
fruit:veto_appledouble = no
fruit:posix_rename = yes
fruit:zero_file_id = yes
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes
min protocol = SMB2
vfs objects = fruit streams_xattr
veto files = /._*/.DS_Store/
delete veto files = yes
'';
shares = {
pictures = {
path = "/home/Shares/Pictures";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "nequi";
"force group" = "users";
"valid users" = "nequi sarah";
};
tv = {
path = "/home/Shares/TV";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "nequi";
"force group" = "users";
"valid users" = "nequi";
};
};
};
smartd.enable = true;
};
services.logrotate.checkConfig = false;
system = {
autoUpgrade = {
channel = "https://nixos.org/channels/nixos-24.05";
dates = "15:00";
enable = true;
};
};
systemd.tmpfiles.rules = [ "d /etc/gcs 0700 root root" ];
time.timeZone = "America/Toronto";
}