-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.nix
131 lines (108 loc) · 3.8 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
{ system, lib, pkgs, modulesPath, backend, static, ... }: {
imports = [
# Adds availableKernelModules, kernelModules for instances running under QEMU (Ie Hetzner Cloud)
(modulesPath + "/profiles/qemu-guest.nix")
# Contains the configuration for the disk layout
./disk-config.nix
backend.nixosModules.x86_64-linux.default
static.nixosModules.x86_64-linux.default
];
# enable experimental features flakes and nix-command
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 10d";
};
# Use the GRUB 2 boot loader.
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;
};
# Enable ssh access to the root user
users.users.root.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDh6bzSNqVZ1Ba0Uyp/EqThvDdbaAjsJ4GvYN40f/p9Wl4LcW/MQP8EYLvBTqTluAwRXqFa6fVpa0Y9Hq4kyNG62HiMoQRjujt6d3b+GU/pq7NN8+Oed9rCF6TxhtLdcvJWHTbcq9qIGs2s3eYDlMy+9koTEJ7Jnux0eGxObUaGteQUS1cOZ5k9PQg+WX5ncWa3QvqJNxx446+OzVoHgzZytvXeJMg91gKN9wAhKgfibJ4SpQYDHYcTrOILm7DLVghrcU2aFqLKVTrHSWSugfLkqeorRadHckRDr2VUzm5eXjcs4ESjrG6viKMKmlF1wxHoBrtfKzJ1nR8TGWWeH9NwXJtQ+qRzAhnQaHZyCZ6q4HvPlxxXOmgE+JuU6BCt6YPXAmNEMdMhkqYis4xSzxwWHvko79NnKY72pOIS2GgS6Xon0OxLOJ0mb66yhhZB4hUBb02CpvCMlKSLtvnS+2IcSGeSQBnwBw/wgp1uhr9ieUO/wY5K78w2kYFhR6Iet55gutbikSqDgxzTmuX3Mkjq0L/MVUIRAdmOysrR2Lxlk692IrNYTtUflQLsSfzrp6VQIKPxjfrdFhHIfbPoUdfMf+H06tfwkGONgcej56/fDjFbaHouZ357wcuwDsuMGNRCdyW7QyBXF/Wi28nPq/KSeOdCy+q9KDuOYsX9n/5Rsw== cardno:000614320136"
];
networking.firewall = {
enable = true;
allowedTCPPorts = [ 80 443 ];
};
services = {
backend = {
enable = true;
domain = "fedi.flakm.com";
posts_path = "${static.packages.x86_64-linux.default}/bloglist.json";
};
static-website = {
enable = true;
domain = "blog.flakm.com";
};
nginx = {
enable = true;
appendHttpConfig = ''
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$host"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
'';
virtualHosts."blog.flakm.com" = {
forceSSL = true;
enableACME = true;
};
virtualHosts."fedi.flakm.com" = {
forceSSL = true;
enableACME = true;
};
commonHttpConfig =
let
realIpsFromList = lib.strings.concatMapStringsSep "\n" (x: "set_real_ip_from ${x};");
fileToList = x: lib.strings.splitString "\n" (builtins.readFile x);
cfipv4 = fileToList (pkgs.fetchurl {
url = "https://www.cloudflare.com/ips-v4";
sha256 = "0ywy9sg7spafi3gm9q5wb59lbiq0swvf0q3iazl0maq1pj1nsb7h";
});
cfipv6 = fileToList (pkgs.fetchurl {
url = "https://www.cloudflare.com/ips-v6";
sha256 = "1ad09hijignj6zlqvdjxv7rjj8567z357zfavv201b9vx3ikk7cy";
});
in
''
${realIpsFromList cfipv4}
${realIpsFromList cfipv6}
real_ip_header CF-Connecting-IP;
'';
};
};
security.acme = {
acceptTerms = true;
certs = {
"blog.flakm.com".email = "me@flakm.com";
"fedi.flakm.com".email = "me@flakm.com";
};
};
system.stateVersion = "23.11";
environment.systemPackages = with pkgs; [
git
vim
tmux
htop
curl
jq
sqlite
ponysay
];
services.tailscale = {
enable = true;
openFirewall = true;
};
}